Hi All,

I'm using gdb to debug a C code which does file processing.
The file i'm processing has about 100,000 records.
The code runs fine until the 30,000 records and after that it produces garbage value. Could i use gdb to run the code until it reaches 30,000 records and then set breakpoints from the 30,000 records onwards to analyze the variables causing the garbage value?

http://www.yolinux.com/TUTORIALS/GDB-Commands.html
Eg.
"break line-number if condition"

A condition being perhaps your record number.

But consider the possibility that this is where the problem is noticed first, not where it has gone wrong.

Hi,

in the condition part of the break, can i use variables declared within my C program. Wat i mean is , i have a variable to count the no of records, can i use the same variable?

I did try using the variable,but the gdb seems to be debuggin from Record 1.. Not sure wats happening..

The record counter is a 2-byte integer and it should be a 4-byte long to prevent overflow at record 32767 - possibly! ;-)

i have declared the counter as long unsigned int

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.