diff options
author | Daniel Jacobowitz <drow@false.org> | 2007-04-13 13:54:06 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2007-04-13 13:54:06 +0000 |
commit | e499d0f17ebb7248296ce707cfcb88723a9e222c (patch) | |
tree | 8152bb29f941f383d4a881cd55af996d92c2d788 /gdb/solib-svr4.c | |
parent | 4d5b2cd77496dd32c80ec0dde093bd466604fea8 (diff) | |
download | gdb-e499d0f17ebb7248296ce707cfcb88723a9e222c.zip gdb-e499d0f17ebb7248296ce707cfcb88723a9e222c.tar.gz gdb-e499d0f17ebb7248296ce707cfcb88723a9e222c.tar.bz2 |
* solib-svr4.c (IGNORE_FIRST_LINK_MAP_ENTRY): Do not ignore the
first entry for static executables.
(breakpoint_addr): Delete unused variable.
(elf_locate_base): Search for _r_debug in static executables.
(enable_break): Do not set breakpoint_addr. Scan solib_break_names
also.
Diffstat (limited to 'gdb/solib-svr4.c')
-rw-r--r-- | gdb/solib-svr4.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 54a27b3..105ff33 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -239,12 +239,16 @@ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + /* Assume that everything is a library if the dynamic loader was loaded + late by a static executable. */ + if (bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL) + return 0; + return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset, builtin_type_void_data_ptr) == 0; } static CORE_ADDR debug_base; /* Base of dynamic linker structures */ -static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */ /* Validity flag for debug_loader_offset. */ static int debug_loader_offset_p; @@ -387,7 +391,18 @@ elf_locate_base (void) /* Find the start address of the .dynamic section. */ dyninfo_sect = bfd_get_section_by_name (exec_bfd, ".dynamic"); if (dyninfo_sect == NULL) - return 0; + { + /* This may be a static executable. Look for the symbol + conventionally named _r_debug, as a last resort. */ + struct minimal_symbol *msymbol; + + msymbol = lookup_minimal_symbol ("_r_debug", NULL, symfile_objfile); + if (msymbol != NULL) + return SYMBOL_VALUE_ADDRESS (msymbol); + else + return 0; + } + dyninfo_addr = bfd_section_vma (exec_bfd, dyninfo_sect); /* Read in .dynamic section, silently ignore errors. */ @@ -1111,10 +1126,19 @@ enable_break (void) "and track explicitly loaded dynamic code.")); } - /* Scan through the list of symbols, trying to look up the symbol and - set a breakpoint there. Terminate loop when we/if we succeed. */ + /* Scan through the lists of symbols, trying to look up the symbol and + set a breakpoint there. Terminate loop when we/if we succeed. */ + + for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++) + { + msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); + if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0)) + { + create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol)); + return 1; + } + } - breakpoint_addr = 0; for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++) { msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); |