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

get_pid() conflicts with GDB's GEF plugin #67

Closed
nikosChalk opened this issue Apr 12, 2021 · 3 comments
Closed

get_pid() conflicts with GDB's GEF plugin #67

nikosChalk opened this issue Apr 12, 2021 · 3 comments
Assignees
Labels

Comments

@nikosChalk
Copy link

Overview

ret-sync plugin does not work when used in combination with GEF GDB.

Details

Currently the get_pid() function (ext_gdb/sync.py#L131) conflicts with a function in GEF that has the same name, is also at the global namespace, and takes zero arguments github.com/hugsy/gef/blob/master/gef.py#L2671.

Temporary workaround

A temporary workaround until this gets fixed is to rename all occurrences of get_pid in ext_gdb/sync.py to something that does not conflict, e.g. get_pid__ret_sync

Log

nikos@laptop:~/tmp$ gdb ~/test-binary
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2

For help, type "help".
Type "apropos word" to search for commands related to "word"...
[sync] init
[sync] 18 commands added
Reading symbols from /home/nikos/test-binary...
(No debugging symbols found in /home/nikos/test-binary)
(gdb) sync
[sync] initializing tunnel to IDA using localhost:9100...
[sync] sync is now enabled with host localhost
(gdb) source ~/bin/binaries/.gdbinit-gef.py
GEF for linux ready, type `gef' to start, `gef config' to configure
91 commands loaded for GDB 9.2 using Python engine 3.8
[*] 1 command could not be loaded, run `gef missing` to know why.
gef➤  b *0x00401211
Breakpoint 1 at 0x401211
gef➤  r
Starting program: /home/nikos/test-binary

Breakpoint 1, 0x0000000000401211 in ?? ()
Python Exception <class 'TypeError'> get_pid() got an unexpected keyword argument 'ctx':
[ Legend: Modified register | Code | Heap | Stack | String ]
─── registers ───
$rax   : 0x0
$rbx   : 0x00000000004017b0  →   endbr64
...
bootleg added a commit that referenced this issue Apr 12, 2021
Helper functions in global namespace may conflict with other plugins (ex. GEF). Wrap them in a class and use static methods.

Thank @nikosChalk for reporting issue #67
@bootleg bootleg self-assigned this Apr 12, 2021
@bootleg bootleg added the bug label Apr 12, 2021
@bootleg
Copy link
Owner

bootleg commented Apr 12, 2021

Thank you @nikosChalk

I fixed a similar issue a couple of monthes ago with PEDA. To be more future proof I moved the helper functions into a dedicated class.
Could you confirm it is now working as expected for you as well please?

@nikosChalk
Copy link
Author

Yes it works as expected, thanks for the very quick update @bootleg !

@bootleg
Copy link
Owner

bootleg commented Apr 15, 2021

Perfect, thank you for the feedback. I am closing this one, please reopen if necessary.

@bootleg bootleg closed this as completed Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants