Re: execution of inactive statement in gdb run

jhh <[email protected]>
Newsgroups gmane.comp.gdb.general
Organization ADC
Message-ID <[email protected]>
  You have to decide on some circumstance that will make you stop at a 
particular line.  For example, instead of "if(0)" something like "if (i 
== 50) ".  gdb also lets you put a condition on a break.   For example, 
break main.c:35 gives you a breakpoint number one at that line.  Now 
give the command "condition 1 i == 50" and it will only stop there when 
the condition is satisfied.
  I usually find putting the condition directly in the code,  as in 
"if(i == 50 && j < 5 && b < 0) {  \  printf("I am here\n"); }" to be 
easier if the condition has to be very complicated, as looking for one 
wrong number somewhere in a loop with a million passes.

>> On Friday 07 September 2007 17:54:12 Prakash Barnwal wrote:
>>     
>>> Hi ,
>>>
>>> I want to run gdb and wants to execute a particular line of code which
>>> is not feasible in normal flow ;
>>>
>>> main(){
>>> int i = 0;
>>>
>>> printf ("i=== %d\n",i);
>>> if(0){
>>>    printf("I am here\n");
>>> }
>>> In this case if(0) will always be false but I want to execute line
>>> (printf("I am here\n");) in gdb run. Could you please help me how to do
>>> this ?
>>>       
>> You might be able to use continue from a specified line number
>>
>>
>>
>>
>>
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.