Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make reopt output more readable for humans #269

Merged
merged 3 commits into from
Aug 7, 2023
Merged

make reopt output more readable for humans #269

merged 3 commits into from
Aug 7, 2023

Conversation

Ptival
Copy link
Contributor

@Ptival Ptival commented Aug 7, 2023

I'm constantly frustrated by the output of Reopt. This makes it a bit more verbose, not great, but at least gives a vague idea of what is going okay, and what is going wrong.

BEFORE:

Initialization
  Complete.
Searching for dynamic dependency libc.so.6's debug info...
No debug info for libc.so.6 found.
Header Processing
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Block 0x40547a: Unclassified control flow transfer.
  Incomplete.

  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.
  Complete.

AFTER:

  [BEGIN] Initialization
  [ END ] Initialization.
Searching for dynamic dependency libc.so.6's debug info...
No debug info for libc.so.6 found.
  [BEGIN] Header Processing
  [ END ] Header Processing.
  [ END ] Discovering for function _init(0x402000)
  [ END ] Discovering for function _start(0x402590)
  [ END ] Discovering for function _dl_relocate_static_pie(0x4025c0)
  [ END ] Discovering for function deregister_tm_clones(0x4025d0)
  [ END ] Discovering for function register_tm_clones(0x402600)
  [ END ] Discovering for function __do_global_dtors_aux(0x402640)
  [ END ] Discovering for function frame_dummy(0x402670)
  [ END ] Discovering for function ziperr(0x402680)
  [ END ] Discovering for function freeup(0x402b20)
  [ END ] Discovering for function error(0x402e60)
  [ END ] Discovering for function zipmessage_nl(0x402e80)
  [ END ] Discovering for function zipmessage(0x403040)
  [ END ] Discovering for function zipwarn(0x403140)
  [ END ] Discovering for function encr_passwd(0x403240)
  [ END ] Discovering for function rename_split(0x4032c0)
  [ END ] Discovering for function set_filetype(0x403350)
  Block 0x40547a: Unclassified control flow transfer.
→ Branch: IP is not an mux:
let r12636 := (bv_add rbp_0 (0xfffffffffffffcb8 :: [64]))
    r12637 := read_mem r12636 (bvle8)
    r12638 := (bv_mul (0x8 :: [64]) r12637)
    r12639 := (bv_add r12638 (0x429008 :: [64]))
    r12640 := read_mem r12639 (bvle8)
 in r12640
→ no return call: Noreturn target r12640 is not a valid address.
→ Call: Call classifier failed.
→ Return: Pattern match failure in 'do' block at src/Data/Macaw/Discovery/Classifier.hs:280:5-18
→ Jump table: Absolute jump table: Upper bounds failed:
let r12636 := (bv_add rbp_0 (0xfffffffffffffcb8 :: [64]))
    r12637 := read_mem r12636 (bvle8)
 in r12637
rsp = stack_frame - 1160
rbp = stack_frame - 8
→ Jump table: Relative jump table: Unaligned IP not a mem offset: r12640
→ PLT stub: Pattern match failure in 'do' block at src/Data/Macaw/Discovery/Classifier/PLT.hs:121:5-18
→ Jump: Jump value r12640 is not a valid address.
→ Tail call: Expected stack height of 0
  Incomplete.

  [ END ] Discovering for function help(0x40bb10)
  [ END ] Discovering for function version_info(0x40bbc0)
  [ END ] Discovering for function handler(0x40be10)
  [ END ] Discovering for function finish(0x40be60)
  [ END ] Discovering for function help_extended(0x40c110)
  [ END ] Discovering for function license(0x40c170)

ReoptGlobalStepWarning _st msg ->
hPutStrLn stderr $ printf " %s" msg
hPutStrLn stderr $ printf " [ WARN] %s" msg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be worth having top-level warn, begin, end, etc. functions to print a line of output with these heralds. Right now, this function would be the only call site, but I could see these being useful in other contexts later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Ideally I'd also like to use an actual logging library (something like Kevin's lumberjack), might try to do the change on my own time.
But as a quick fix, I could at least extract these indeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this look?
1e0741b

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I could have folded in the hPutStrLn call too.

@Ptival Ptival merged commit 362eb88 into main Aug 7, 2023
2 checks passed
@Ptival Ptival deleted the vr/better-output branch August 7, 2023 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants