Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Does gdb can handle longjmp in i386 and amd64 now?
@ 2009-09-02 14:22 Hui Zhu
  2009-09-02 15:12 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Hui Zhu @ 2009-09-02 14:22 UTC (permalink / raw)
  To: gdb

Hi guys,

I try the following code with gdb in i386 and amd64:
#include   <setjmp.h>
#include   <stdio.h>
jmp_buf j;

void
raise_exception (void)
{
	//printf ("exception   raised\n");
	longjmp (j, 1);		/*   jump   to   exception   handler   */
	printf ("this   line   should   never   appear\n");
}

int
main (void)
{
	if (setjmp (j) == 0)
	{
		printf ("''setjmp''   is   initializing   ''j''\n");
		raise_exception ();
		printf ("this   line   should   never   appear\n");
	}
	else
	{
		printf ("''setjmp''   was   just   jumped   into\n");
		/*   this   code   is   the   exception   handler   */
	}

	return 0;
}


In i386, what I got is:

(gdb) start
Temporary breakpoint 1 at 0x80483ff: file 1.c, line 16.
Starting program: /home/teawater/gdb/a.out

Temporary breakpoint 1, main () at 1.c:16
16		if (setjmp (j) == 0)
(gdb) s
18			printf ("''setjmp''   is   initializing   ''j''\n");
(gdb) s
''setjmp''   is   initializing   ''j''
19			raise_exception ();
(gdb)
raise_exception () at 1.c:9
9		longjmp (j, 1);		/*   jump   to   exception   handler   */
(gdb)
0xb7ea3e61 in siglongjmp () from /lib/tls/i686/cmov/libc.so.6
(gdb) s
Single stepping until exit from function siglongjmp,
which has no line number information.
''setjmp''   was   just   jumped   into

Program exited normally.



In amd64, what I got is:
(gdb) start
Temporary breakpoint 1 at 0x4005c3: file 1.c, line 16.
Starting program: /home/teawater/gdb/a.out

Temporary breakpoint 1, main () at 1.c:16
warning: Source file is more recent than executable.
16		if (setjmp (j) == 0)
(gdb) s
18			printf ("''setjmp''   is   initializing   ''j''\n");
(gdb) s
''setjmp''   is   initializing   ''j''
19			raise_exception ();
(gdb)
raise_exception () at 1.c:9
9		longjmp (j, 1);		/*   jump   to   exception   handler   */
(gdb)
''setjmp''   was   just   jumped   into

Program exited normally.


Are this right?

Thanks,
Hui


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

* Re: Does gdb can handle longjmp in i386 and amd64 now?
  2009-09-02 14:22 Does gdb can handle longjmp in i386 and amd64 now? Hui Zhu
@ 2009-09-02 15:12 ` Tom Tromey
  2009-09-02 15:17   ` Mark Kettenis
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2009-09-02 15:12 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb

>>>>> ">" == Hui Zhu <teawater@gmail.com> writes:

>> I try the following code with gdb in i386 and amd64:

This is http://sourceware.org/bugzilla/show_bug.cgi?id=9270.  glibc's PC
mangling confuses gdb.  Pedro has a patch for this; I keep forgetting
what is holding it back.

Tom


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

* Re: Does gdb can handle longjmp in i386 and amd64 now?
  2009-09-02 15:12 ` Tom Tromey
@ 2009-09-02 15:17   ` Mark Kettenis
  2009-09-02 15:22     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Kettenis @ 2009-09-02 15:17 UTC (permalink / raw)
  To: tromey; +Cc: teawater, gdb

> From: Tom Tromey <tromey@redhat.com>
> Date: Wed, 02 Sep 2009 09:12:23 -0600
> 
> >>>>> ">" == Hui Zhu <teawater@gmail.com> writes:
> 
> >> I try the following code with gdb in i386 and amd64:
> 
> This is http://sourceware.org/bugzilla/show_bug.cgi?id=9270.  glibc's PC
> mangling confuses gdb.  Pedro has a patch for this; I keep forgetting
> what is holding it back.

I think it was the fact that it requires GDB to dig into glibc
internals in combination with Ulrich Drepper no wanting to commit
keeping those internals consistent.


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

* Re: Does gdb can handle longjmp in i386 and amd64 now?
  2009-09-02 15:17   ` Mark Kettenis
@ 2009-09-02 15:22     ` Tom Tromey
  2009-09-03  1:44       ` Hui Zhu
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2009-09-02 15:22 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: teawater, gdb

>>>>> "Mark" == Mark Kettenis <mark.kettenis@xs4all.nl> writes:

Mark> I think it was the fact that it requires GDB to dig into glibc
Mark> internals in combination with Ulrich Drepper no wanting to commit
Mark> keeping those internals consistent.

Oh, yeah, I forgot about the randomness and confused the current
situation with a bug report I sent about gdb not working even with the
LD_POINTER_GUARD=0 case:
    http://sourceware.org/bugzilla/show_bug.cgi?id=9832

In that case I think we can safely teach gdb about the mangling.
In other cases, I don't know what to do.  Continue to lose, I guess.

Tom


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

* Re: Does gdb can handle longjmp in i386 and amd64 now?
  2009-09-02 15:22     ` Tom Tromey
@ 2009-09-03  1:44       ` Hui Zhu
  0 siblings, 0 replies; 5+ messages in thread
From: Hui Zhu @ 2009-09-03  1:44 UTC (permalink / raw)
  To: tromey; +Cc: Mark Kettenis, gdb

On Wed, Sep 2, 2009 at 23:22, Tom Tromey<tromey@redhat.com> wrote:
>>>>>> "Mark" == Mark Kettenis <mark.kettenis@xs4all.nl> writes:
>
> Mark> I think it was the fact that it requires GDB to dig into glibc
> Mark> internals in combination with Ulrich Drepper no wanting to commit
> Mark> keeping those internals consistent.
>
> Oh, yeah, I forgot about the randomness and confused the current
> situation with a bug report I sent about gdb not working even with the
> LD_POINTER_GUARD=0 case:
>    http://sourceware.org/bugzilla/show_bug.cgi?id=9832
>
> In that case I think we can safely teach gdb about the mangling.
> In other cases, I don't know what to do.  Continue to lose, I guess.
>
> Tom
>

......

Hui


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

end of thread, other threads:[~2009-09-03  1:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-02 14:22 Does gdb can handle longjmp in i386 and amd64 now? Hui Zhu
2009-09-02 15:12 ` Tom Tromey
2009-09-02 15:17   ` Mark Kettenis
2009-09-02 15:22     ` Tom Tromey
2009-09-03  1:44       ` Hui Zhu

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