Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa] Extra warning in solib-svr4
@ 2007-03-30 14:45 Daniel Jacobowitz
  2007-03-30 19:02 ` Mark Kettenis
  2007-04-10  6:53 ` Kevin Buettner
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-03-30 14:45 UTC (permalink / raw)
  To: gdb-patches, Kevin Buettner

Suppose you take a static linked program, strip it, and run it under
GDB.  You'll get this warning:

warning: shared library handler failed to enable breakpoint

You can reproduce this without stripping - you need to have no .interp
section and no functions named _start or main, that's all.  So this
actually came up when using KGDB to debug a Linux kernel.

The shared library breakpoint is generally not important in this
case.  It's more important if there was a .interp but something went
wrong while trying to load the referenced executable; that's got a
separate warning:

      warning (_("Unable to find dynamic linker breakpoint function.\n"
               "GDB will be unable to debug shared library initializers\n"
               "and track explicitly loaded dynamic code."));

I think the more general warning is not useful, since it has a high
correlation with non-shared programs.  OK to remove it?

-- 
Daniel Jacobowitz
CodeSourcery

2007-03-30  Daniel Jacobowitz  <dan@codesourcery.com>

	* solib-svr4.c (enable_break): Simplify return value.
	(svr4_solib_create_inferior_hook): Do not warn if enable_break fails.

Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.61
diff -u -p -r1.61 solib-svr4.c
--- solib-svr4.c	9 Jan 2007 17:58:58 -0000	1.61
+++ solib-svr4.c	30 Mar 2007 14:39:46 -0000
@@ -979,8 +979,6 @@ exec_entry_point (struct bfd *abfd, stru
 static int
 enable_break (void)
 {
-  int success = 0;
-
 #ifdef BKPT_AT_SYMBOL
 
   struct minimal_symbol *msymbol;
@@ -1146,13 +1144,9 @@ enable_break (void)
 	  return 1;
 	}
     }
-
-  /* Nothing good happened.  */
-  success = 0;
-
 #endif /* BKPT_AT_SYMBOL */
 
-  return (success);
+  return 0;
 }
 
 /*
@@ -1357,10 +1351,7 @@ svr4_solib_create_inferior_hook (void)
     }
 
   if (!enable_break ())
-    {
-      warning (_("shared library handler failed to enable breakpoint"));
-      return;
-    }
+    return;
 
 #if defined(_SCO_DS)
   /* SCO needs the loop below, other systems should be using the


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa] Extra warning in solib-svr4
  2007-03-30 14:45 [rfa] Extra warning in solib-svr4 Daniel Jacobowitz
@ 2007-03-30 19:02 ` Mark Kettenis
  2007-04-10  6:53 ` Kevin Buettner
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Kettenis @ 2007-03-30 19:02 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches, kevinb

> Date: Fri, 30 Mar 2007 10:45:19 -0400
> From: Daniel Jacobowitz <drow@false.org>
> 
> Suppose you take a static linked program, strip it, and run it under
> GDB.  You'll get this warning:
> 
> warning: shared library handler failed to enable breakpoint
> 
> You can reproduce this without stripping - you need to have no .interp
> section and no functions named _start or main, that's all.  So this
> actually came up when using KGDB to debug a Linux kernel.

Trying to debug a stripped static program is a rather silly thing to
do.  That said ...

> The shared library breakpoint is generally not important in this
> case.  It's more important if there was a .interp but something went
> wrong while trying to load the referenced executable; that's got a
> separate warning:
> 
>       warning (_("Unable to find dynamic linker breakpoint function.\n"
>                "GDB will be unable to debug shared library initializers\n"
>                "and track explicitly loaded dynamic code."));
> 
> I think the more general warning is not useful, since it has a high
> correlation with non-shared programs.  OK to remove it?

... I think the simplification is good, so no objection from me.

> 2007-03-30  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* solib-svr4.c (enable_break): Simplify return value.
> 	(svr4_solib_create_inferior_hook): Do not warn if enable_break fails.
> 
> Index: solib-svr4.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/solib-svr4.c,v
> retrieving revision 1.61
> diff -u -p -r1.61 solib-svr4.c
> --- solib-svr4.c	9 Jan 2007 17:58:58 -0000	1.61
> +++ solib-svr4.c	30 Mar 2007 14:39:46 -0000
> @@ -979,8 +979,6 @@ exec_entry_point (struct bfd *abfd, stru
>  static int
>  enable_break (void)
>  {
> -  int success = 0;
> -
>  #ifdef BKPT_AT_SYMBOL
>  
>    struct minimal_symbol *msymbol;
> @@ -1146,13 +1144,9 @@ enable_break (void)
>  	  return 1;
>  	}
>      }
> -
> -  /* Nothing good happened.  */
> -  success = 0;
> -
>  #endif /* BKPT_AT_SYMBOL */
>  
> -  return (success);
> +  return 0;
>  }
>  
>  /*
> @@ -1357,10 +1351,7 @@ svr4_solib_create_inferior_hook (void)
>      }
>  
>    if (!enable_break ())
> -    {
> -      warning (_("shared library handler failed to enable breakpoint"));
> -      return;
> -    }
> +    return;
>  
>  #if defined(_SCO_DS)
>    /* SCO needs the loop below, other systems should be using the
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa] Extra warning in solib-svr4
  2007-03-30 14:45 [rfa] Extra warning in solib-svr4 Daniel Jacobowitz
  2007-03-30 19:02 ` Mark Kettenis
@ 2007-04-10  6:53 ` Kevin Buettner
  2007-04-10 11:51   ` Daniel Jacobowitz
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2007-04-10  6:53 UTC (permalink / raw)
  To: gdb-patches

On Fri, 30 Mar 2007 10:45:19 -0400
Daniel Jacobowitz <drow@false.org> wrote:

> 	* solib-svr4.c (enable_break): Simplify return value.
> 	(svr4_solib_create_inferior_hook): Do not warn if enable_break fails.

Okay.

Kevin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa] Extra warning in solib-svr4
  2007-04-10  6:53 ` Kevin Buettner
@ 2007-04-10 11:51   ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-04-10 11:51 UTC (permalink / raw)
  To: gdb-patches

On Mon, Apr 09, 2007 at 11:53:44PM -0700, Kevin Buettner wrote:
> On Fri, 30 Mar 2007 10:45:19 -0400
> Daniel Jacobowitz <drow@false.org> wrote:
> 
> > 	* solib-svr4.c (enable_break): Simplify return value.
> > 	(svr4_solib_create_inferior_hook): Do not warn if enable_break fails.
> 
> Okay.

Thanks, I checked it in.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-10 11:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-30 14:45 [rfa] Extra warning in solib-svr4 Daniel Jacobowitz
2007-03-30 19:02 ` Mark Kettenis
2007-04-10  6:53 ` Kevin Buettner
2007-04-10 11:51   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox