Compiling and debugging code with gcc/gdb
Posted in 2008
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Licensing & Editions, Platform-Specific Issues, Internationalization & Character Sets
Hi, I Just migrate to IDS 11.50.FC2 on Solaris 9, I tried to debug code with gdb and I found the problem below, somebody knows how to fix this problem. On IDS 10 it was working fine. brsmccts03:/1h01/rfacio/pvcs/DETRAF/PRODUCAO/C/AGC/SRC> cat comp (the script I use to compile) esql -Wall \\\\ -m64 \\\\ -lpthread \\\\ -I../INCLUDE \\\\ -D_LARGEFILE64_SOURCE \\\\ -D_GNU_SOURCE \\\\ -g \\\\ -o \\\\ agcUnix \\\\ funcoes.ec \\\\ AGCUnix.ec \\\\ carga.ec \\\\ db.ec \\\\ brsmccts03:/1h01/rfacio/pvcs/DETRAF/PRODUCAO/C/AGC/SRC> comp (when compiling it show some warnings, but it always happens) esqlc: "carga.ec", line 75: Warning -33208: Runtime error is possible because size of '_dbMneRota' is unknown. esqlc: "carga.ec", line 75: Warning -33208: Runtime error is possible because size of '_dbCSP' is unknown. esqlc: "carga.ec", line 75: Warning -33208: Runtime error is possible because size of '_dbFlagRota' is unknown. esqlc: "carga.ec", line 171: Warning -33208: Runtime error is possible because size of '_dbMneRota' is unknown. ... (many Warnings like these) esqlc: "carga.ec", line 2957: Warning -33208: Runtime error is possible because size of '_db_gr_port' is unknown. 244 warning(s) brsmccts03:/1h01/rfacio/pvcs/DETRAF/PRODUCAO/C/AGC/SRC> gdb agcUnix GNU gdb 6.4 Copyright 2005 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.9"... (gdb) b main Breakpoint 1 at 0x100002520: file AGCUnix.ec, line 78. (gdb) r Starting program: /1d/1h01/rfacio/pvcs/DETRAF/PRODUCAO/C/AGC/SRC/agcUnix warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.) elfread.c:342: internal-error: sect_index_data not initialized A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) y elfread.c:342: internal-error: sect_index_data not initialized I'm using gcc version 3.4.2 and gdb version GNU gdb 6.4, both 64 bits and ids 64bits. gcc -v Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.2/specs Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls Thread model: posix gcc version 3.4.2 gdb -v GNU gdb 6.4 Copyright 2005 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.9". Thank you, Celso Coimbra
On Mon, Nov 10, 2008 at 10:37 AM, Celso Cabral Coimbra <ccoimbra@cleartech.com.br> wrote: > Hi, > I Just migrate to IDS 11.50.FC2 on Solaris 9, I tried to debug code with > gdb and I found the problem below, somebody knows how to fix this > problem. On IDS 10 it was working fine. > > brsmccts03:/1h01/rfacio/pvcs/DETRAF/PRODUCAO/C/AGC/SRC> cat comp > (the script I use to compile) > esql -Wall \\\\ > -m64 \\\\ > -lpthread \\\\ > -I../INCLUDE \\\\ > -D_LARGEFILE64_SOURCE \\\\ > -D_GNU_SOURCE \\\\ > -g \\\\ The 'esql' script treats '-g' as an option to it (see the manual) and does not relay the option to the C compiler. Consequently, the way I get the -g option to the C compiler is by setting the INFORMIXC environment variable to "cc -g" or "gcc -g" or equivalent. > -o \\\\ > agcUnix \\\\ > funcoes.ec \\\\ > AGCUnix.ec \\\\ > carga.ec \\\\ > db.ec \\\\ > brsmccts03:/1h01/rfacio/pvcs/DETRAF/PRODUCAO/C/AGC/SRC> comp > (when compiling it show some warnings, but it always happens) > esqlc: "carga.ec", line 75: Warning -33208: Runtime error is possible > because size of '_dbMneRota' is unknown. > esqlc: "carga.ec", line 75: Warning -33208: Runtime error is possible > because size of '_dbCSP' is unknown. > esqlc: "carga.ec", line 75: Warning -33208: Runtime error is possible > because size of '_dbFlagRota' is unknown. > esqlc: "carga.ec", line 171: Warning -33208: Runtime error is possible > because size of '_dbMneRota' is unknown. > .... (many Warnings like these) > esqlc: "carga.ec", line 2957: Warning -33208: Runtime error is possible > because size of '_db_gr_port' is unknown. > 244 warning(s) There was a recent discussion about this in one of the IIUG mailing lists. IMNSHO, it is a spurious (or, at least, semi-spurious) warning. Although you can ignore it, it is usually possible to get rid of it, albeit not trivially. > brsmccts03:/1h01/rfacio/pvcs/DETRAF/PRODUCAO/C/AGC/SRC> gdb agcUnix > GNU gdb 6.4 > Copyright 2005 Free Software Foundation, Inc. >[...snip...] > This GDB was configured as "sparc-sun-solaris2.9"... > (gdb) b main > Breakpoint 1 at 0x100002520: file AGCUnix.ec, line 78. > (gdb) r > Starting program: /1d/1h01/rfacio/pvcs/DETRAF/PRODUCAO/C/AGC/SRC/agcUnix > warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.) > > elfread.c:342: internal-error: sect_index_data not initialized > A problem internal to GDB has been detected, > further debugging may prove unreliable. > Quit this debugging session? (y or n) y > elfread.c:342: internal-error: sect_index_data not initialized Hmmm...I've had problems with GDB on Solaris 10. I ended up creating one without the TUI, I seem to remember, and it mostly works. I'll dig out the information I received and send it on. > I'm using gcc version 3.4.2 and gdb version GNU gdb 6.4, both 64 bits > and ids 64bits. > > gcc -v > Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.2/specs > Configured with: ../configure --with-as=/usr/ccs/bin/as > --with-ld=/usr/ccs/bin/ld --disable-nls > Thread model: posix > gcc version 3.4.2 > > gdb -v > GNU gdb 6.4 > Copyright 2005 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you > are > welcome to change it and/or distribute copies of it under certain > conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for > details. > This GDB was configured as "sparc-sun-solaris2.9". -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2008.0513 -- http://dbi.perl.org/ "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." NB: Please do not use this email for correspondence. I don't necessarily read it every week, even.