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

Fix the symbol parsing in Plan9 #23084

Merged
merged 2 commits into from
Jul 2, 2024
Merged

Fix the symbol parsing in Plan9 #23084

merged 2 commits into from
Jul 2, 2024

Conversation

shurizzle
Copy link
Contributor

  • Mark this if you consider it ready to merge
  • I've added tests (optional)
  • I wrote some lines in the book (optional)

Symbol parsing for Plan9's a.out files was failing both because the content of type Z (which is currently ignored) was not being discarded, and because a UT8_MAX (255 or 0xff) was being read in the PC table and treated as an error when it is actually a valid value.

@trufae
Copy link
Collaborator

trufae commented Jul 2, 2024

Can you add a test for this? Code looks good

@shurizzle
Copy link
Contributor Author

Can you add a test for this? Code looks good

Honestly, it's a bit difficult for me to add tests for Plan9 since none currently exist and I would have to create them from scratch. I don't have the time to do that, and I used radare2 for the first time today. Maybe if you help me, I can provide you with an a.out file that fails without the patch. I'm sorry.

@trufae
Copy link
Collaborator

trufae commented Jul 2, 2024

There are tests for plan9 in this file test/db/formats/plan9. You can uploda the binary in the testbins repository and then just copypaste one of those tests changing the FILE and CMDS fields, and then just run r2r -i test/db/formats/plan9 to fix the output. if you dont feel comfy or don't have time don't worry much and just share the executable and i'll write the tests. but as long as you did the code and tested it you probably know better than me what's wrong and what's correct

@shurizzle
Copy link
Contributor Author

The point is that without the patch, it fails "silently," meaning it gives you the decompiled assembly but discards all the symbols. Since I'm really just starting, it would be great if I could create 2 minimal binaries (just an entry point calling exits(nil)) and include the two bugs. Then, you could check that it correctly exports _main (the entry point). If you tell me which folder to place them in, I'll do it as soon as possible. Thank you.

@trufae trufae merged commit 31d0fa3 into radareorg:master Jul 2, 2024
37 of 38 checks passed
@trufae
Copy link
Collaborator

trufae commented Jul 2, 2024

i've just merged i'll wait for the binaries and i can do the tests later as i said. there are other r2/plan9 users here, so maybe others can help here. thanks for the contrib! and glad r2 worked well for your needs

@shurizzle
Copy link
Contributor Author

shurizzle commented Jul 2, 2024

@trufae How can I send you the 2 a.out files? 89B and 78B respectively. base64 and copypaste here can be a solution apparently. :D

@trufae
Copy link
Collaborator

trufae commented Jul 2, 2024

Submit a pr to this repo placing the bins in the right directory https://github.com/radareorg/radare2-testbins

thank you!

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