1

How do I get the line number of an error in a JNI library (which I wrote) from a java core dump ? Alternatively, can I get the line numbers directly in the core dump ?

Here are 2 examples, depending on the java options (I added -XX:+UnlockDiagnosticVMOptions and -XX:+ShowHiddenFrames to the 2nd one). AMIn2_* are the names of my C functions.

$ grep AMIn2 /tmp/hs_err_pid3688886.log
J 11555  net.hep.ami.utility.n2edm.AMIreadN2DataJNI.AMIn2_GetRunNumbersJSON(Ljava/lang/String;I)Ljava/lang/String; (0 bytes) @ 0x00007f003d64e3fa [0x00007f003d64e3a0+0x000000000000005a]

$ grep AMIn2 /tmp/hs_err_pid1598986.log
j  net.hep.ami.utility.n2edm.AMIreadN2DataJNI.AMIn2_GetSubsystemsJSON(Ljava/lang/String;II)Ljava/lang/String;+0
j  net.hep.ami.utility.n2edm.AMIreadN2Data.AMIn2_GetSubsystemsJSON(Ljava/lang/String;II)Ljava/lang/String;+3
R13={method} {0x00007f20f8ba29f8} 'AMIn2_GetSubsystemsJSON' '(Ljava/lang/String;II)Ljava/lang/String;' in 'net/hep/ami/utility/n2edm/AMIreadN2DataJNI'
stack at sp + 4 slots: 0x00007f21100a7fea: AMIn2_GetSubsystemsJSON+0x000000000000022d in /opt/AMI/externalLib/libAMIreadN2Data_swig.so at 0x00007f211009c000

I have tried variants of:

$ addr2line -e lib*_swig.so -a 0x00007f20f8ba29f8 
0x00007f20f8ba29f8
??:0

$ addr2line -e lib*_swig.so -f -C 0x00007f20f8ba29f8 
??
??:0

Do I need to add or substract the base address ? And if so how do I find it in the core file (greping for base leads nowhere) ?

dargaud
  • 2,431
  • 2
  • 26
  • 39

0 Answers0