This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setjmp


> 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.yang@simplnano.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]