-
Notifications
You must be signed in to change notification settings - Fork 39
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
Error "Unable to find the text segment base addr" if space present in binary path #69
Comments
Hi @Angelo942, to clarify, you are running a local binary (not remote), and you are getting this error if a space is in the binary path? |
My immediate hunch is that this line is the cause of this issue. If you wanted to debug it before I can get to it (which will likely be this weekend), you can set a breakpoint here and see what's going on:
This is if you are running locally. |
I tested it both debugging a local process and a remote one. The bug is present every time we pass a copy of the binary to gdb. so I took a look at the code and we have a problem here, where the path_name used is truncated:
I tried changing the parse to: def vmmap_base_addrs():
addr_maps = {}
mappings = gdb.execute("info proc mappings", to_string=True).split("\n")
for mapping in mappings:
try:
addr = int(re.findall(r"0x[0-9a-fA-F]+", mapping)[0], 16)
path = "/" + "/".join(mapping.split("/")[1:])
except IndexError:
continue
# always use the lowest addr
if path in addr_maps or path == "/":
continue
if addr and path:
addr_maps[path] = addr
return addr_maps This solves the problem for local processes, but not for remote ones. (I focus on that part because
Now I'm trying to figure out why the hash is right with |
Linking this GEF issue which may fix some stuff for us: hugsy/gef#999 |
This one too hugsy/gef#998 |
Hi,
I played with this error for the past two days and pinpointed it to when the local binary passed to gdb contains a space in it's absolute path.
This happens in native gdb and with pwndbg too, but not GEF. Unfortunately GEF as a similar problem when connecting to a gdbserver (hugsy/gef#901 (comment)) so I have to work around it anyway.
I know that gdb has always had troubles with paths containing spaces, but it's the first time after a year working with this setup that I notice one so I don't know if the problems lies in gdb or this library.
The text was updated successfully, but these errors were encountered: