From a7c02bc8e11894a2c8ac3f834961f214229a4d51 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 7 Jan 2008 15:19:58 +0000 Subject: [PATCH] Ignore change in name of dynamic linker during execution, on Solaris. This also unbreaks pending breakpoints. * solist.h (struct target_so_ops): New field same. * solib-svr4.c (svr4_same): New. (_initialize_svr4_solib): Register svr4_same. * solib.c (update_solib_list): Use ops->same, if available. --- gdb/ChangeLog | 10 ++++++++++ gdb/solib-svr4.c | 20 ++++++++++++++++++++ gdb/solib.c | 12 ++++++++++-- gdb/solist.h | 4 ++++ 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 370f829d240..66d677e337d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2008-01-07 Vladimir Prus + + Ignore change in name of dynamic linker during + execution on Solaris. This also unbreaks pending breakpoints. + + * solist.h (struct target_so_ops): New field same. + * solib-svr4.c (svr4_same): New. + (_initialize_svr4_solib): Register svr4_same. + * solib.c (update_solib_list): Use ops->same, if available. + 2008-01-06 Christopher Faylor * win32-nat.c (win32_make_so): Use cygwin-style path to avoid warnings diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index ef460aac242..4c9e82dd940 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1569,6 +1569,25 @@ elf_lookup_lib_symbol (const struct objfile *objfile, (objfile, name, linkage_name, domain, symtab); } +static int +svr4_same (struct so_list *gdb, struct so_list *inferior) +{ + if (! strcmp (gdb->so_original_name, inferior->so_original_name)) + return 1; + + /* On Solaris, when starting inferior we think that dynamic linker is + /usr/lib/ld.so.1, but later on, the table of loaded shared libraries + contains /lib/ld.so.1. Sometimes one file is a link to another, but + sometimes they have identical content, but are not linked to each + other. We don't restrict this check for Solaris, but the chances + of running into this situation elsewhere are very low. */ + if (strcmp (gdb->so_original_name, "/usr/lib/ld.so.1") == 0 + && strcmp (inferior->so_original_name, "/lib/ld.so.1") == 0) + return 1; + + return 0; +} + extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */ void @@ -1585,4 +1604,5 @@ _initialize_svr4_solib (void) svr4_so_ops.open_symbol_file_object = open_symbol_file_object; svr4_so_ops.in_dynsym_resolve_code = svr4_in_dynsym_resolve_code; svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol; + svr4_so_ops.same = svr4_same; } diff --git a/gdb/solib.c b/gdb/solib.c index 815ab292269..69680b455cb 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -538,8 +538,16 @@ update_solib_list (int from_tty, struct target_ops *target) the inferior's current list. */ while (i) { - if (! strcmp (gdb->so_original_name, i->so_original_name)) - break; + if (ops->same) + { + if (ops->same (gdb, i)) + break; + } + else + { + if (! strcmp (gdb->so_original_name, i->so_original_name)) + break; + } i_link = &i->next; i = *i_link; diff --git a/gdb/solist.h b/gdb/solist.h index a047177e296..01f734fcdad 100644 --- a/gdb/solist.h +++ b/gdb/solist.h @@ -115,6 +115,10 @@ struct target_so_ops const domain_enum domain, struct symtab **symtab); + /* Given two so_list objects, one from the GDB thread list + and another from the list returned by current_sos, return 1 + if they represent the same library. */ + int (*same) (struct so_list *gdb, struct so_list *inferior); }; /* Free the memory associated with a (so_list *). */ -- 2.30.2