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

Debugging fails for statically linked programs #2

Open
sth opened this issue Nov 18, 2022 · 0 comments
Open

Debugging fails for statically linked programs #2

sth opened this issue Nov 18, 2022 · 0 comments

Comments

@sth
Copy link
Owner

sth commented Nov 18, 2022

Debugging a statically linked program fails:

$ gcc -gdwarf -no-pie -static -o tests/hello tests/hello.c
$ ups/ups tests/hello
Can't find shared library information in ELF executable ./blah (no `.dynamic' section)
Hello world
Fatal internal error: ao_read_text_from_process with no proc (aborting) ...
Dumping core ... Aborted (core dumped)

ptrace_init_pid is called with a valid pid at some point, but in ao_read_text_from_process
ip->ip_pid is zero. There are several placed where ip_pid might get reset to zero.

There seems to be a historical issue with statically linked programs:

ups/ups/ao_elflib.c

Lines 1274 to 1282 in c1fb509

if (!get_elf_shlib_info(ap, el, &soname, &rpath, &runpath, &debug_vaddr,
&dyn_symtab_vaddr, &dyn_strtab_vaddr,
&plt_rel_vaddr, &plt_rel_type))
{
/* RGA completely statically linked targets used to return
FALSE at this point, terminiating the debug seesion.
Changed to continue with null data.
*/
}

@sth sth changed the title Support statically linked binaries Debugging fails for statically linked programs Nov 18, 2022
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

No branches or pull requests

1 participant