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 namebreak and add additional unit tests #710

Merged
merged 1 commit into from
Sep 5, 2021
Merged

Conversation

Kileak
Copy link
Contributor

@Kileak Kileak commented Sep 5, 2021

Fix namebreak and add additional unit tests

Description/Motivation/Screenshots

fix #707

Using parse_address, when the user already specified a direct address like *0x40600 will result in dereferencing the address instead of just passing it to Breakpoint.

This patch replaces the default value for address, if none is given, with *$pc instead of $pc and removes parsing of the address completely, since user input will already be in the correct format for Breakpoint.

This way nb behaves more like default b command again

gef➤  nb testpc
Breakpoint 1 at 0x7ffff7ebde82: file ../sysdeps/unix/sysv/linux/read.c, line 26.
gef➤  nb testdirect *0x7ffff7ebde8a
Breakpoint 2 at 0x7ffff7ebde8a: file ../sysdeps/unix/sysv/linux/read.c, line 26.
gef➤  nb testdirect *0x7ffff7ebde8a+4
Breakpoint 3 at 0x7ffff7ebde8e: file ../sysdeps/unix/sysv/linux/read.c, line 26.
gef➤  nb testsymbol *read+32
Breakpoint 4 at 0x7ffff7ebde90: file ../sysdeps/unix/sysv/linux/read.c, line 26.

Kudos to @theguy147 for adding unit tests on namebreak. Added some additional tests, which will also check for direct address breakpoints.

How Has This Been Tested?

Architecture Yes/No Comments
x86-32 ✔️
x86-64 ✔️
ARM ✖️
AARCH64 ✖️
MIPS ✖️
POWERPC ✖️
SPARC ✖️
RISC-V ✖️
make test ✔️

Checklist

  • My PR was done against the dev branch, not master.
  • My code follows the code style of this project.
  • My change includes a change to the documentation, if required.
  • My change adds tests as appropriate.
  • I have read and agree to the CONTRIBUTING document.

@theguy147
Copy link
Collaborator

I agree, this is better than my fix!

@Grazfather Grazfather added this to the Release: next milestone Sep 5, 2021
@Grazfather Grazfather merged commit 8c5abfc into hugsy:dev Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command namebreak seems to be broken
4 participants