qilingframework / qiling

A True Instrumentable Binary Emulation Framework
https://qiling.io
GNU General Public License v2.0
5.06k stars 737 forks source link

Missing function `handle_bnj_arm` #1481

Open Emiluren opened 2 months ago

Emiluren commented 2 months ago

I got a crash in branch_predictor_arm.py where it tries to call handle_bnj_arm.

  [...]
  File "/home/emil/.local/lib/python3.12/site-packages/qiling/debugger/qdb/branch_predictor/branch_predictor_arm.py", line 163, in predict
    n2_addr = handle_bnj_arm(ql, next_addr)
              ^^^^^^^^^^^^^^
NameError: name 'handle_bnj_arm' is not defined

I didn't find any definition and no other use of it in the codebase. Is it an old function that has been removed?

ucgJhe commented 1 month ago

Hi, this function handle_bnj_arm should be predict i will try to make a fix for this, pls test it for me once done it thx

ucgJhe commented 1 month ago

pls test this #1483 and report it here thx

Emiluren commented 1 month ago

Hm, I ran into a different problem when trying to test. Now qdb doesn't open for me using this:

    ql.debugger = 'qdb'
    ql.debug_stop = True

I was running on master before. Using git bisect I figured out I start having problems at 6799389

ucgJhe commented 1 month ago

can you provide the sample binary for fixing this ?

Emiluren commented 1 month ago

Here is my script and the program I'm trying to run: qdb_issue.zip

My scripts runs the program until the start of main and then makes a snapshot to start faster next time. Also I run without multithread after loading the snapshot but it doesn't make a difference regarding qdb if run with it on. It only crashes with different errors, either 'NoneType' object has no attribute 'cur_thread' or illegal instruction.

Emiluren commented 1 month ago

With qdb I was going to set a breakpoint at 0x91742baa and step once from there. That triggers the handle_bnj_arm error.

ucgJhe commented 1 month ago

With qdb I was going to set a breakpoint at 0x91742baa and step once from there. That triggers the handle_bnj_arm error.

hi i couldn't repro the error u got cuz a missing library error while loading shared libraries: libecore_evas.so.1: cannot open shared object file: No such file or directory

image

could you pls check again for me ?

Emiluren commented 1 month ago

Oops, sorry. I must have accidentally tested with my snapshot file. There were a whole bunch of libs missing.

Here they are: missing_libs.tar.gz. Just put them in rootfs/lib. (This actually xz compressed to get under Github's 25 MB limit but they don't support xz files so I had to rename it...)