Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* How to check that GDB is going to make a longjmp?
@ 2011-09-07  9:10 adeeshah
  2011-09-07  9:33 ` Kevin Pouget
  0 siblings, 1 reply; 3+ messages in thread
From: adeeshah @ 2011-09-07  9:10 UTC (permalink / raw)
  To: gdb


Hi,

I want to avoid the GDB's longjmp. Is there a way to check that GDB is going
to make a longjmp?

How can i check the contents of jmp_buf?

Adeel.
-- 
View this message in context: http://old.nabble.com/How-to-check-that-GDB-is-going-to-make-a-longjmp--tp32414505p32414505.html
Sent from the Sourceware - gdb list mailing list archive at Nabble.com.


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

* Re: How to check that GDB is going to make a longjmp?
  2011-09-07  9:10 How to check that GDB is going to make a longjmp? adeeshah
@ 2011-09-07  9:33 ` Kevin Pouget
  2011-09-13 13:28   ` adeeshah
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Pouget @ 2011-09-07  9:33 UTC (permalink / raw)
  To: adeeshah; +Cc: gdb

I guess you want to catch longjump of the inferior, not GDB itself, right?

One way is to set a breakpoint on the `longjmp' function itself, and
then jump over the function, or enter `return' to return directly from
the function without executing its body.
The content of the jmp_bug depends of your system, so you need to
check your local setjmp.h. For instance, you can see in this µlibC [1]
implementation that they use a buffer to store the relevant CPU
registers, with pre-processor macro.

setjump populates the buffer with the registers, longjmp pushes the
buffer values back to the CPU registers.


Cordially,

Kevin

[1]: http://cristi.indefero.net/p/uClibc-cristi/source/tree/0_9_29_rc1/libc/sysdeps/linux/cris/bits/setjmp.h

On Wed, Sep 7, 2011 at 11:10 AM, adeeshah <asgher.adeel@gmail.com> wrote:
>
> Hi,
>
> I want to avoid the GDB's longjmp. Is there a way to check that GDB is going
> to make a longjmp?
>
> How can i check the contents of jmp_buf?
>
> Adeel.
> --
> View this message in context: http://old.nabble.com/How-to-check-that-GDB-is-going-to-make-a-longjmp--tp32414505p32414505.html
> Sent from the Sourceware - gdb list mailing list archive at Nabble.com.
>


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

* Re: How to check that GDB is going to make a longjmp?
  2011-09-07  9:33 ` Kevin Pouget
@ 2011-09-13 13:28   ` adeeshah
  0 siblings, 0 replies; 3+ messages in thread
From: adeeshah @ 2011-09-13 13:28 UTC (permalink / raw)
  To: gdb


Hi again, sorry for the later reply.

Well with some more digging I find out that its not the long jumps that are
culprit here.
I actually don't know whats the error but I will try to explain my scenerio.

- I have a C file called main.c and I create a new C file called main2.c
from it.
- The main2.c is actually same as main.c but it contains lines like this,
    #line 112:main.c
- Such lines appear after every line in main2.c so that GDB reads these
lines and create stack frames from there.
- Now when I debug my executable created from main2.c.
- Everything works perfect while stepping but right after my program does
longjump (even the longjmp executes correctly), and then i try to do step
again my stack frames are corrupted. and return me some file with line
number which is not correct.

I am compiling with Mingw on windows 7 using these flags -ggdb -O0
-falign-functions.

Adeel.


Kevin Pouget-2 wrote:
> 
> I guess you want to catch longjump of the inferior, not GDB itself, right?
> 
> One way is to set a breakpoint on the `longjmp' function itself, and
> then jump over the function, or enter `return' to return directly from
> the function without executing its body.
> The content of the jmp_bug depends of your system, so you need to
> check your local setjmp.h. For instance, you can see in this µlibC [1]
> implementation that they use a buffer to store the relevant CPU
> registers, with pre-processor macro.
> 
> setjump populates the buffer with the registers, longjmp pushes the
> buffer values back to the CPU registers.
> 
> 
> Cordially,
> 
> Kevin
> 
> [1]:
> http://cristi.indefero.net/p/uClibc-cristi/source/tree/0_9_29_rc1/libc/sysdeps/linux/cris/bits/setjmp.h
> 
> On Wed, Sep 7, 2011 at 11:10 AM, adeeshah <asgher.adeel@gmail.com> wrote:
>>
>> Hi,
>>
>> I want to avoid the GDB's longjmp. Is there a way to check that GDB is
>> going
>> to make a longjmp?
>>
>> How can i check the contents of jmp_buf?
>>
>> Adeel.
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-check-that-GDB-is-going-to-make-a-longjmp--tp32414505p32414505.html
>> Sent from the Sourceware - gdb list mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-check-that-GDB-is-going-to-make-a-longjmp--tp32414505p32455704.html
Sent from the Sourceware - gdb list mailing list archive at Nabble.com.


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

end of thread, other threads:[~2011-09-13 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-07  9:10 How to check that GDB is going to make a longjmp? adeeshah
2011-09-07  9:33 ` Kevin Pouget
2011-09-13 13:28   ` adeeshah

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