Jan 16, 2013 at 12:38pm UTC
I need to debug an executable compiled and generated from C/Pro *C files on AIX 5.3 server using DBX.This executable is used to parse a file and then load it in oracle database tables.
Before the executable runs on a file,the files lines are filtered and then after that each line is given as input to the whole executable.
Syntax is like below:
awk '<logic>' files.txt| <executable> <some useful flags>
Now since DBX runs on the whole input file and my executable is running line by line,I am not able to debug the executable.
This executable is giving core dump and I need to find out the root cause.
Please help on this on how to debug it and let me know in case any other information is required.
Jan 16, 2013 at 3:20pm UTC
I would save the output of awk to a file, and use
in dbx, if coredump is not sufficient.
run < filename
Jan 16, 2013 at 3:26pm UTC
you need to identify the line that causes the crash. Then you can feed your program with this line in the debugger.
I suggest that you start with the first line and add line by line until the crash occurs.
Jan 17, 2013 at 4:38pm UTC
Hi Cubbi & Coder777,
Thanks for your help.
The issue with core dump is that it doesnt happen every time.
On an average of 1000 files,it only happens for around 10 files.
I had also tried to identify any pattern in the line in which core dump occurs but all in vain because every time the type of line(or say record) is different.So I cannot attribute to which type of record in the files causes it.
Core dump can occur after any record.
Jan 17, 2013 at 5:02pm UTC
So what do you see when you load the coredumps into dbx?
Jan 18, 2013 at 10:43am UTC
I have found during debugging(using where command after dbx reported dump),DBX is pointing to at a malloc memory allocation,see below
pPointerName= malloc (sizeof(struct StructureName_s));
although this is being freed in the end when all the parsing is done.
Is there any way I can avoid using malloc and use some other memory allocation method.
new/delete is used in C++,so dont have that option.