Reputation: 2224
There is a awkward thing, might be not good one to ask, but I want to hear if anyone had similar experience before. I am debugging a huge c source code, and I find where error occurs. it is inside a recursive function.
bool interpret(...)
{
switch(..)
....
....
case INSTR_GETLINK:
{
LmnInstrVar linki, atomi, posi;
READ_VAL(LmnInstrVar, instr, linki);
READ_VAL(LmnInstrVar, instr, atomi);
READ_VAL(LmnInstrVar, instr, posi);
warry_set(rc, linki,
LMN_SATOM_GET_LINK(wt(rc, atomi), posi),
LMN_SATOM_GET_ATTR(wt(rc, atomi), posi),
TT_ATOM);
break;
}
....
}
segmentation fault occurs at "warry_set". bad thing is error dose not occur at first time at that line, it occurs after several times. and this "interpret" function called himself in many other places.
I wanted to find out after how many steps error occurs at "warry_set". I set break point at it by line number. I try to find out,"continue 100", I changed the number many times problem is, sometime "continue 100" reports error, that make me think, error occurs within 100 time at "warry_set". sometime error occurs, between 100-200. I mean by using continue , I could not decide how many steps lead error. I think there is nothing wrong find out exact time of error by this way. but I simply did not occur at certain exact time..
how can I find out exact time of error? experienced guys, please give some suggestion, or correct me if I am doing wrong. also, how to find "warry_set"definition? "step" did not go in that function, and "info function warry_set" did find nothing. :( "whatis warry_set" says , there is no such symbol, maybe I am not loading every symbol.
Thank you in advance
Upvotes: 0
Views: 384
Reputation: 57784
While you might be able to figure out a way to set a good conditional breakpoint, it will probably be far easier to add to warry_set()
writing a message to a file (or the console) maybe including its interesting parameters values.
Upvotes: 1