From grog@lemis.de  Sun Oct 20 05:40:55 1996
Received: from diablo.ppp.de (diablo.ppp.de [193.141.101.34])
          by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id FAA12973
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Oct 1996 05:40:53 -0700 (PDT)
Received: from freebie.lemis.de by diablo.ppp.de with smtp
	(Smail3.1.28.1 #1) id m0vExBS-000Qo5C; Sun, 20 Oct 96 13:40 MET
Received: (grog@localhost) by freebie.lemis.de (8.8.2/8.6.12) 
       id OAA12535; Sun, 20 Oct 1996 14:40:10 +0200 (MET DST)
Message-Id: <199610201240.OAA12535@freebie.lemis.de>
Date: Sun, 20 Oct 1996 14:40:10 +0200 (MET DST)
From: Greg Lehey <grog@lemis.de>
Reply-To: grog@lemis.de
To: FreeBSD-gnats-submit@freebsd.org, grog@freebie.lemis.de
Subject: breakpoints in shared libraries don't fire
X-Send-Pr-Version: 3.2

>Number:         1848
>Category:       kern
>Synopsis:       breakpoints may be set in shared libraries, but they never get hit
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 20 05:50:03 PDT 1996
>Closed-Date:    Fri Jul 9 02:01:33 PDT 1999
>Last-Modified:  Fri Jul  9 02:06:54 PDT 1999
>Originator:     Greg Lehey
>Release:        FreeBSD 2.2-CURRENT-ctm-2592 i386
>Organization:
LEMIS
grog@lemis.de			 Schellnhausen 2
Tel: +49-6637-919123		 36325 Feldatal
Fax: +49-6637-919122		 Germany
>Environment:

	FreeBSD 2.2-current, as of CTM 2592.

>Description:

	It's possible to set breakpoints in shared libraries, but
	executing the code doesn't cause a SIGTRACE.

	I consider this problem relatively serious because it makes it
	very difficult to catch bugs by waiting for them to issue a
	system call.  In this case, the new version of sendmail is
	calling gethostbyaddr() even though it has been compiled
	without DNS support.

>How-To-Repeat:

	I did it with the latest version of sendmail.  Here sample
	output:

	=== root@freebie (/dev/ttyp3) /S/FreeBSD/Mail/sendmail-8.8.2/src 67 -> gdb sendmail  
	GDB 4.13 (i386-unknown-freebsd), Copyright 1994 Free Software Foundation, Inc...
	(gdb) b gethostbyaddr
	Function "gethostbyaddr" not defined.
	(gdb) b main
	Breakpoint 1 at 0x13cf9: file main.c, line 128.
	(gdb) r -bD -q10m
	Starting program: /S/FreeBSD/Mail/sendmail-8.8.2/src/sendmail -bD -q10m
	During symbol reading...unknown symbol type 0x1e...
	
	Breakpoint 1, main (argc=3, argv=0xefbfd344, envp=0xefbfd354) at main.c:128
	128             bool queuemode = FALSE;         /* process queue requests */
	(gdb) b gethostbyaddr
	Breakpoint 2 at 0x808435e
	(gdb) r
	The program being debugged has been started already.
	Start it from the beginning? (y or n) n
	Program not restarted.
	(gdb) c
	Continuing.
	^C
	Program received signal SIGINT, Interrupt.
	0x80a4951 in select ()
	(gdb) bt
	#0  0x80a4951 in select ()
	#1  0x808f610 in res_send ()
	#2  0x808bdd7 in res_query ()
	#3  0x80858d8 in _gethostbydnsaddr ()
	#4  0x80843c2 in gethostbyaddr ()
	#5  0x63d5 in sm_gethostbyaddr ()
	#6  0x66ef in load_if_names ()
	#7  0x14802 in main (argc=3, argv=0xefbfd344, envp=0xefbfd354) at main.c:482
	(gdb) 


>Fix:
	
	Not known

>Release-Note:
>Audit-Trail:

From: Mike Pritchard <mpp>
To: grog@lemis.de
Cc: freebsd-gnats-submit
Subject: Re: kern/1848
Date: Fri, 21 Feb 1997 18:15:43 -0800 (PST)

 Greg Lehey wrote:
 > 	It's possible to set breakpoints in shared libraries, but
 > 	executing the code doesn't cause a SIGTRACE.
 > 
 > 	I consider this problem relatively serious because it makes it
 > 	very difficult to catch bugs by waiting for them to issue a
 > 	system call.  In this case, the new version of sendmail is
 > 	calling gethostbyaddr() even though it has been compiled
 > 	without DNS support.
 
 Why not link the binary with -static so you can debug it?
 Have you tried the latest gdb in -current to see what
 it does?
 -- 
 Mike Pritchard
 mpp@FreeBSD.org
 "Go that way.  Really fast.  If something gets in your way, turn"
State-Changed-From-To: open->closed 
State-Changed-By: grog 
State-Changed-When: Fri Jul 9 02:01:33 PDT 1999 
State-Changed-Why:  
Problem no longer exists. 
>Unformatted:


Greg Lehey, 9 July 1999

	Since this PR was entered, the handling of shared libraries
	has changed completely.  I can confirm that breakpoints now
	work correctly in shared libraries, but you won't be able to
	set them until you hit the main function. 

	Exceptionally, I am closing this PR without waiting for
	feedback.
