Reputation: 1022
I'm unable to debug core file generated from AIX machine.
uname -a
AIX dev 1 6
file /usr/bin/ld
/usr/bin/ld: executable (RISC System/6000) or object module
oslevel -g
Fileset - bos.rte
Actual Level - 6.1.7.15
Below is the gdb trace from the core file generated.
gdb A_CustInstr core
how to get valid information?
This GDB was configured as "powerpc-ibm-aix5.1.0.0".
Core was generated by A_CustInstr.
Program terminated with signal 11, Segmentation fault.
#0 0x09000000007e4b70 in ?? ()
(gdb) bt
#0 0x09000000007e4b70 in ?? ()
#1 0xffffffffffffffff in ?? ()
#2 0x09000000007e43ec in ?? ()
#3 0x090000000002bab0 in ?? ()
#4 0x09000000033940c0 in ?? ()
#5 0x0900000003400d54 in ?? ()
#6 0x0900000003394444 in ?? ()
#7 0x00000000000047e0 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Upvotes: 1
Views: 2826
Reputation: 2349
Dump the registers and find the iar. Then see if you can dump the address that the iar is pointed to as code and also as ascii. If you are in C code (and not ctr0 or some obscure library), the name of the function will be at the bottom of the function.
Then you can either set a break point for that function or you can set a break point for maybe an instruction or two ahead of where the iar is. I would also run it a half dozen times to see if the iar is consistently in the same place.
I don't use gdb enough to know the commands and syntax for what I just described.
You might need to recompile without optimization to make any sense of what the code is doing.
If the iar proves completely useless, look at the lr. If that is also useless, then start decoding the stack by hand. r1 points to a stack frame. r1[0] is a pointer to the next stack frame. r1[2] is the return address. The return address of the first stack frame is probably not valid with the code is optimized. If all of those fail, you are going to have to fall back to either trace with gdb or printf's.
The only AIX specific tweak I can think of is to make sure you have fullcore turned on: lsattr -Elsys0 -a fullcore but if you are running it from gdb, that won't matter.
Last: if you do find the iar and decode the instruction it is pointing to, then look at the registers that instruction is referencing and that will tell you what exactly is causing the fault (either loading from someplace you can't touch or storing to someplace you can't modify). That might give you a clue as to where you are in your program and what is going wrong.
Good luck
Upvotes: 1