diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2003-09-29 17:35:35 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2003-09-29 17:35:35 +0000 |
commit | fd79fe98d84bb2f3ee96200ae1e00064cc8989ff (patch) | |
tree | f634475826bb77f2b7448c56f92a34e273d9c848 | |
parent | fda0518d0ee90fab80e5e440d82a3f1e2c12012c (diff) | |
download | binutils-gdb-fd79fe98d84bb2f3ee96200ae1e00064cc8989ff.tar.gz |
2003-09-29 Elena Zannoni <ezannoni@redhat.com>
* solib-svr4.c: Include gdbcmd.h.
(debug_solib): New variable.
(elf_locate_base): Add some debugging statements.
(svr4_current_sos): Likewise.
(enable_break): Likewise.
(svr4_relocate_main_executable): Likewise.
(_initialize_svr4_solib): Add new 'set' command to control
debugging output.
* Makefile.in (solib-svr4.o): Update dependencies.
-rw-r--r-- | gdb/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/Makefile.in | 3 | ||||
-rw-r--r-- | gdb/solib-svr4.c | 55 |
3 files changed, 66 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 76ed750fe9d..aedcf454dbc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2003-09-29 Elena Zannoni <ezannoni@redhat.com> + + * solib-svr4.c: Include gdbcmd.h. + (debug_solib): New variable. + (elf_locate_base): Add some debugging statements. + (svr4_current_sos): Likewise. + (enable_break): Likewise. + (svr4_relocate_main_executable): Likewise. + (_initialize_svr4_solib): Add new 'set' command to control + debugging output. + * Makefile.in (solib-svr4.o): Update dependencies. + 2003-09-16 Andrew Cagney <cagney@redhat.com> * buildsym.c: Remove more occurances of "register". diff --git a/gdb/Makefile.in b/gdb/Makefile.in index f3a55098554..0f03ca03e9d 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2286,7 +2286,8 @@ solib-sunos.o: solib-sunos.c $(defs_h) $(gdb_string_h) $(symtab_h) $(bfd_h) \ $(bcache_h) $(regcache_h) solib-svr4.o: solib-svr4.c $(defs_h) $(elf_external_h) $(elf_common_h) \ $(elf_mips_h) $(symtab_h) $(bfd_h) $(symfile_h) $(objfiles_h) \ - $(gdbcore_h) $(target_h) $(inferior_h) $(solist_h) $(solib_svr4_h) + $(gdbcore_h) $(target_h) $(inferior_h) $(solist_h) $(solib_svr4_h) \ + $(gdbcmd_h) sol-thread.o: sol-thread.c $(defs_h) $(gdbthread_h) $(target_h) \ $(inferior_h) $(gdb_stat_h) $(gdbcmd_h) $(gdbcore_h) $(regcache_h) \ $(symfile_h) $(gregset_h) diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 7fda5e4e020..48252ed21f8 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -33,6 +33,7 @@ #include "gdbcore.h" #include "target.h" #include "inferior.h" +#include "gdbcmd.h" #include "solist.h" #include "solib-svr4.h" @@ -116,6 +117,9 @@ static char *main_name_list[] = NULL }; +/* Control the printing of debugging statements. */ +static int debug_solib; + /* Macro to extract an address from a solib structure. When GDB is configured for some 32-bit targets (e.g. Solaris 2.7 sparc), BFD is configured to handle 64-bit targets, so CORE_ADDR is 64 bits. We @@ -432,14 +436,26 @@ 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; + { + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "elf_locate_base: didn't find .dynamic in %s\n", + exec_bfd->filename); + return 0; + } dyninfo_addr = bfd_section_vma (exec_bfd, dyninfo_sect); /* Read in .dynamic section, silently ignore errors. */ dyninfo_sect_size = bfd_section_size (exec_bfd, dyninfo_sect); buf = alloca (dyninfo_sect_size); if (target_read_memory (dyninfo_addr, buf, dyninfo_sect_size)) - return 0; + { + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "elf_locate_base: coudn't read 0x%s\n", + paddr_nz (dyninfo_addr)); + return 0; + } /* Find the DT_DEBUG entry in the the .dynamic section. For mips elf we look for DT_MIPS_RLD_MAP, mips elf apparently has @@ -466,6 +482,10 @@ elf_locate_base (void) { dyn_ptr = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr); + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "elf_locate_base: DT_DEBUG entry has value 0x%s\n", + paddr_nz (dyn_ptr)); return dyn_ptr; } else if (dyn_tag == DT_MIPS_RLD_MAP) @@ -732,7 +752,12 @@ svr4_current_sos (void) /* If we can't find the dynamic linker's base structure, this must not be a dynamically linked executable. Hmm. */ if (! debug_base) - return 0; + { + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "svr4_current_sos: no DT_DEBUG found\n"); + return 0; + } } /* Walk the inferior's link map list, and build our list of @@ -784,6 +809,10 @@ svr4_current_sos (void) new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; xfree (buffer); strcpy (new->so_original_name, new->so_name); + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "svr4_current_sos: Processing DSO: %s\n", + new->so_name); } /* If this entry has no name, or its name matches the name @@ -976,6 +1005,10 @@ enable_break (void) /* Find the .interp section; if not found, warn the user and drop into the old breakpoint at symbol code. */ interp_sect = bfd_get_section_by_name (exec_bfd, ".interp"); + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "enable_break: search for .interp in %s\n", + exec_bfd->filename); if (interp_sect) { unsigned int interp_sect_size; @@ -1008,6 +1041,10 @@ enable_break (void) if (tmp_fd >= 0) tmp_bfd = bfd_fdopenr (tmp_pathname, gnutarget, tmp_fd); + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "enable_break: opening %s\n", tmp_pathname); + if (tmp_bfd == NULL) goto bkpt_at_symbol; @@ -1086,6 +1123,9 @@ enable_break (void) if (sym_addr != 0) { create_solib_event_breakpoint (load_addr + sym_addr); + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "enable_break: solib bp set\n"); return 1; } @@ -1232,6 +1272,11 @@ svr4_relocate_main_executable (void) The same language also appears in Edition 4.0 of the System V ABI and is left unspecified in some of the earlier editions. */ + fprintf_unfiltered (gdb_stdlog, + "relocate_main: current pc is %s, bfd_start_address is %s\n", + paddr_nz (pc), + paddr_nz (bfd_get_start_address (exec_bfd))); + displacement = pc - bfd_get_start_address (exec_bfd); changed = 0; @@ -1500,4 +1545,8 @@ _initialize_svr4_solib (void) /* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */ current_target_so_ops = &svr4_so_ops; + add_show_from_set (add_set_cmd ("solib", no_class, var_zinteger, + (char *) &debug_solib, + "Set debugging of GNU/Linux shlib module.\n\ +Enables printf debugging output.\n", &setdebuglist), &showdebuglist); } |