Skip to content

Debugging fails for statically linked programs #2

@sth

Description

@sth

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.
*/
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions