Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

$ make BUILD_IOCS=YES USR_CFLAGS="-ggdb -O0" USR_CXXFLAGS="-ggdb -O0"

With that, the debug symbols are included in the resulting executable (-ggdb) .  However, optimization is still enabled (-03) and I don't know whyand all compiler optimizations are disabled.

With the debug symbols in the resulting executable, you get an error message when starting gdb and running the executable.  So you need to add this to your ~/.gdbinit file:

...

And now you should be ok to debug.


egumtow@lcls-dev3 ~/code/ipmiComm/iocs/ipmicomm-test-IOC/iocBoot/iocipmicomm-test-IOC> gdb ../../bin/rhel6-x86_64/ipmicomm-test-IOC
[...]
(gdb) b init_fru_stringin_record
Breakpoint 1 at 0x447f25: file ../devMch.c, line 1509.
(gdb) r ./st.cmd 
Breakpoint 1, init_fru_stringin_record (pstringin=0x8ab520) at ..

...

/devMch.c:1509
1509    MchRec  recPvt  = 0; /* Info stored with record */
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.212.el6_10.3.x86_64 ncurses-libs-5.7-4.20090207.el6.x86_64 readline-6.0-4.el6.x86_64
(gdb) bt
#0  init_fru_stringin_record (pstringin=0x8ab520) at ../devMch.c:1509
#1  0x00000000004b4b79 in init_record (pcommon=0x8ab520, pass=<value optimized out>) at ../rec/stringinRecord.c:119
#2  0x00000000004fc2cd in doInitRecord1 () at ../misc/iocInit.c:553
#3  iterateRecords () at ../misc/iocInit.c:485
#4  initDatabase () at ../misc/iocInit.c:561
#5  iocBuild_2 () at ../misc/iocInit.c:163
#6  0x00000000004fc505 in iocBuild () at ../misc/iocInit.c:202
#7  0x00000000004fc569 in iocInit () at ../misc/iocInit.c:107
#8  0x0000000000500be9 in iocInitCallFunc (args=<value optimized out>) at ../misc/miscIocRegister.c:25
#9  0x000000000053eee2 in iocshBody (pathname=<value optimized out>, commandLine=0x0, macros=0x0) at ../iocsh/iocsh.cpp:925
#10 0x000000000043e9d0 in main (argc=2, argv=0x7fffffffad58) at ../ipmicomm-test-IOCMain.cpp:17