This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Fix auto-solib-add bug (simplified patch)
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH] Fix auto-solib-add bug (simplified patch)
- From: fnf at ninemoons dot com
- Date: Sat, 9 Sep 2000 14:01:13 -0700 (MST)
- Cc: fnf at cygnus dot com
- Reply-To: fnf at cygnus dot com
On 6 Sep I submitted a patch to fix a solib problem when
auto_solib_add is zero. On further reflection, I decided that patch
was overkill and am submitting a new, greatly simplified patch.
If this patch is acceptable, please apply it to the repository. If
not, please let me know. Thanks.
-Fred
2000-09-09 Fred Fish <fnf@cygnus.com>
* irix5-nat.c (solib_create_inferior_hook): Don't use
auto_solib_add to decide whether or not to call solib_add. Just
call it unconditionally and let solib_add use auto_solib_add to
decide whether or not to load symbols.
* osfsolib.c (solib_create_inferior_hook): Ditto.
* solib.c (solib_create_inferior_hook): Ditto.
* infcmd.c (attach_command): Don't use auto_solib_add to decide
whether or not to call SOLIB_ADD. Just call it unconditionally
and let SOLIB_ADD use auto_solib_add to decide whether or not to
load symbols.
* infrun.c (handle_inferior_event): Ditto.
* coff-solib.c (coff_solib_add): Only add symbols if user explicitly
requested it, or if auto_solib_add is nonzero.
* irix5-nat.c (solib_add): Ditto.
* osfsolib.c (solib_add): Ditto.
* solib.c (solib_add): Ditto.
* xcoffsolib.c (solib_add):
Index: coff-solib.c
===================================================================
RCS file: /cvs/src/src/gdb/coff-solib.c,v
retrieving revision 1.2
diff -u -p -r1.2 coff-solib.c
--- coff-solib.c 2000/07/30 01:48:24 1.2
+++ coff-solib.c 2000/09/09 20:27:56
@@ -52,6 +52,9 @@ coff_solib_add (char *arg_string, int fr
{
asection *libsect;
+ if (!from_tty && !auto_solib_add)
+ return;
+
libsect = bfd_get_section_by_name (exec_bfd, ".lib");
if (libsect)
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.11
diff -u -p -r1.11 infcmd.c
--- infcmd.c 2000/09/02 00:07:13 1.11
+++ infcmd.c 2000/09/09 20:27:57
@@ -1689,12 +1689,9 @@ attach_command (char *args, int from_tty
}
#ifdef SOLIB_ADD
- if (auto_solib_add)
- {
- /* Add shared library symbols from the newly attached process, if any. */
- SOLIB_ADD ((char *) 0, from_tty, ¤t_target);
- re_enable_breakpoints_in_shlibs ();
- }
+ /* Add shared library symbols from the newly attached process, if any. */
+ SOLIB_ADD ((char *) 0, from_tty, ¤t_target);
+ re_enable_breakpoints_in_shlibs ();
#endif
/* Take any necessary post-attaching actions for this platform.
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.18
diff -u -p -r1.18 infrun.c
--- infrun.c 2000/09/02 00:08:05 1.18
+++ infrun.c 2000/09/09 20:27:58
@@ -1517,15 +1517,12 @@ handle_inferior_event (struct execution_
remove_breakpoints ();
/* Check for any newly added shared libraries if we're
- supposed to be adding them automatically. */
- if (auto_solib_add)
- {
- /* Switch terminal for any messages produced by
- breakpoint_re_set. */
- target_terminal_ours_for_output ();
- SOLIB_ADD (NULL, 0, NULL);
- target_terminal_inferior ();
- }
+ supposed to be adding them automatically. Switch
+ terminal for any messages produced by
+ breakpoint_re_set. */
+ target_terminal_ours_for_output ();
+ SOLIB_ADD (NULL, 0, NULL);
+ target_terminal_inferior ();
/* Reinsert breakpoints and continue. */
if (breakpoints_inserted)
@@ -2438,15 +2435,12 @@ handle_inferior_event (struct execution_
breakpoints_inserted = 0;
/* Check for any newly added shared libraries if we're
- supposed to be adding them automatically. */
- if (auto_solib_add)
- {
- /* Switch terminal for any messages produced by
- breakpoint_re_set. */
- target_terminal_ours_for_output ();
- SOLIB_ADD (NULL, 0, NULL);
- target_terminal_inferior ();
- }
+ supposed to be adding them automatically. Switch
+ terminal for any messages produced by
+ breakpoint_re_set. */
+ target_terminal_ours_for_output ();
+ SOLIB_ADD (NULL, 0, NULL);
+ target_terminal_inferior ();
/* Try to reenable shared library breakpoints, additional
code segments in shared libraries might be mapped in now. */
Index: irix5-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/irix5-nat.c,v
retrieving revision 1.8
diff -u -p -r1.8 irix5-nat.c
--- irix5-nat.c 2000/08/09 20:09:01 1.8
+++ irix5-nat.c 2000/09/09 20:27:58
@@ -870,6 +870,9 @@ solib_add (char *arg_string, int from_tt
int count;
int old;
+ if (!from_tty && !auto_solib_add)
+ return;
+
if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
{
error ("Invalid regexp: %s", re_err);
@@ -1241,8 +1244,7 @@ solib_create_inferior_hook (void)
and will put out an annoying warning.
Delaying the resetting of stop_soon_quietly until after symbol loading
suppresses the warning. */
- if (auto_solib_add)
- solib_add ((char *) 0, 0, (struct target_ops *) 0);
+ solib_add ((char *) 0, 0, (struct target_ops *) 0);
stop_soon_quietly = 0;
}
Index: osfsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/osfsolib.c,v
retrieving revision 1.5
diff -u -p -r1.5 osfsolib.c
--- osfsolib.c 2000/07/30 01:48:26 1.5
+++ osfsolib.c 2000/09/09 20:27:58
@@ -614,6 +614,9 @@ solib_add (char *arg_string, int from_tt
int count;
int old;
+ if (!from_tty && !auto_solib_add)
+ return;
+
if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
{
error ("Invalid regexp: %s", re_err);
@@ -887,8 +890,7 @@ solib_create_inferior_hook (void)
and will put out an annoying warning.
Delaying the resetting of stop_soon_quietly until after symbol loading
suppresses the warning. */
- if (auto_solib_add)
- solib_add ((char *) 0, 0, (struct target_ops *) 0);
+ solib_add ((char *) 0, 0, (struct target_ops *) 0);
stop_soon_quietly = 0;
}
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.22
diff -u -p -r1.22 solib.c
--- solib.c 2000/08/31 00:39:10 1.22
+++ solib.c 2000/09/09 20:27:59
@@ -1579,6 +1579,7 @@ solib_add (char *pattern, int from_tty,
/* Walk the list of currently loaded shared libraries, and read
symbols for any that match the pattern --- or any whose symbols
aren't already loaded, if no pattern was given. */
+ if (from_tty || auto_solib_add)
{
int any_matches = 0;
int loaded_any_symbols = 0;
@@ -2187,8 +2188,7 @@ solib_create_inferior_hook (void)
warning ("shared library handler failed to disable breakpoint");
}
- if (auto_solib_add)
- solib_add ((char *) 0, 0, (struct target_ops *) 0);
+ solib_add ((char *) 0, 0, (struct target_ops *) 0);
#endif /* ! _SCO_DS */
#endif
}
Index: xcoffsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/xcoffsolib.c,v
retrieving revision 1.5
diff -u -p -r1.5 xcoffsolib.c
--- xcoffsolib.c 2000/07/30 01:48:28 1.5
+++ xcoffsolib.c 2000/09/09 20:27:59
@@ -56,6 +56,9 @@ solib_add (char *arg_string, int from_tt
int loaded = 0; /* true if any shared obj loaded */
int matched = 0; /* true if any shared obj matched */
+ if (!from_tty && !auto_solib_add)
+ return;
+
if (arg_string == 0)
re_comp (".");
else if (val = (char *) re_comp (arg_string))