List Info

Thread: Re: setjmp




Re: setjmp
country flaguser name
United States
2007-04-27 22:17:37
 > Is there has "setjmp" command in gdb? 
Example:
 >
 > setjmp( a )
 > if( x )
 >     do A
 > else
 >     do B
 > longjmp a
 >
 > After longjmp a , gdb will go to setjmp(a), and the
enviroment keep
 > the same as first run to there .
Maybe you can use the checkpoint related commands. But it is
implemented in GDB 
as forked processes. So if your target does not support
process, the checkpoint 
command may not work.

 > I think it is a meaningful function, we can debug
"do A" and "do B"
 > without rerun the program.
However, actually, when you use checkpoint, GDB leaves the
current process 
waiting and forks another process to go on. It gives you
some convenience by 
using more resources. I think you can reorganize your code
and use dummy 
function call to avoid this. Or you can reset PC and all
registers, but the 
environment maybe has some differences.

Wenbo
-- 
Wenbo Yang
Department of Mathematics, Nanjing Univ. 22 Hankou Road,
Nanjing, China
SimpLight Nanoelectronics Ltd. 6 Zhichun Road, 10th Floor,
Beijing, China
Phone: +86-10-5126-6989 ext.110  ---  Email: wenbo.yangsimplnano.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )