Article View: gnu.gdb.bug
Article #359gdb 4.6 bug with longjmp breakpoints and sun sys5 libs
From: Dave Morrison
Date: Wed, 12 Aug 1992 03:35
Date: Wed, 12 Aug 1992 03:35
71 lines
2364 bytes
2364 bytes
It came to my attention that the simple longjmp program:
#include <setjmp.h>
main()
{
jmp_buf env;
int err;
if (err = setjmp(env))
{
printf("World (%d)!\n", err);
} else {
printf("Hello, ");
longjmp(env, 1);
}
}
was not working when stepped/nexted, but worked fine when run normally
or continued through. Looking at some breakpoints, I saw:
(gdb) mai in br
Num Type Disp Enb Address What
-1 longjmp keep n 0x00002404 <longjmp>
-2 longjmp keep n 0x00002404 <longjmp>
-3 longjmp resume keep n 0x00000000 <_DYNAMIC>
1 breakpoint keep y 0x0000227c in main at jmptest.c:5
(gdb)
Multiple breakpoints on the same address, hmmm. Well, turns out this
was compiled using the sys5 libraries (on sunos 4.1.2) which has:
% nm /usr/5lib/libc.a | grep jmp
_setjmp.o:
0000002c T __longjmp
00000000 T __setjmp
0000002c T _longjmp
00000000 T _setjmp
Yes, folks, longjmp and _longjmp are the *same*. Gdb sets breakpoints
for longjmp, _longjmp, and siglongjmp, and never checks for duplicates
believing that they will be always be different. Ooops?
This small little patch seems to get me by for the time being. I didn't
put a lot of thought into the correctness of the patch. Someone with
more know how than I should take a look at the longjmp breakpoint code,
and see how it should make sense with the above in mind.
----------------------------------------------------------------------
*** breakpoint.c Wed Aug 12 04:30:29 1992
--- breakpoint.c-dist Mon Jul 6 10:10:37 1992
***************
*** 1290,1299 ****
ALL_BREAKPOINTS (b)
if (b->type == bp_longjmp)
! {
! b->enable = enabled;
! check_duplicates (b->address);
! }
}
void
--- 1290,1296 ----
ALL_BREAKPOINTS (b)
if (b->type == bp_longjmp)
! b->enable = enabled;
}
void
Technical Details
Message-ID:
<9208121135.AA08742@teal.us.oracle.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!us.oracle.COM!drmorrisShow Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!us.oracle.COM!drmorris From: drmorris@us.oracle.COM (Dave Morrison) Subject: gdb 4.6 bug with longjmp breakpoints and sun sys5 libs Message-ID: <9208121135.AA08742@teal.us.oracle.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 12 Aug 1992 03:35:51 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 72