Debugging Pro*C using DBX on AIX

Hi All,

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.
I would save the output of awk to a file, and use run < filename in dbx, if coredump is not sufficient.
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.
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.

So what do you see when you load the coredumps into dbx?

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.
Topic archived. No new replies allowed.