From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3094 invoked by alias); 19 Dec 2005 09:57:02 -0000 Received: (qmail 3084 invoked by uid 22791); 19 Dec 2005 09:57:00 -0000 X-Spam-Check-By: sourceware.org Received: from ns1.prolix.ro (HELO mail.prolix.ro) (82.77.59.34) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 19 Dec 2005 09:56:57 +0000 Received: from [82.77.63.137] (home.prolix.ro [82.77.63.137]) by mail.prolix.ro (Postfix) with ESMTP id ADBFFB26E for ; Mon, 19 Dec 2005 11:56:46 +0200 (EET) Subject: gdb on AIX From: Petchesi Gabriel Horatiu To: gdb@sources.redhat.com Content-Type: text/plain Date: Mon, 19 Dec 2005 09:57:00 -0000 Message-Id: <1134986205.16296.30.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2005-12/txt/msg00157.txt.bz2 Hi! I'm having the following problems with gdb on AIX 5.2, 32 bit, Power PC architecture: 1. Debugging static variables with gdb 6.0 This problem problem generated more grief than anything else. If in a program i have a static global variable I'm not able to monitor the value. The tracing/monitoring of local variables works fine. ====================================================================== $ more main.c #include static int32_t i = 0; int main(int argc, char **argv) { while (1) { printf("Value %d\n", i); sleep(2); i++; } } $ make gcc -c -o main.o -ggdb3 main.c gcc -o bb -ggdb3 main.o $ gdb ./bb GNU gdb 6.0 Copyright 2003 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 "powerpc-ibm-aix5.1.0.0"... (gdb) break main.c:11 Breakpoint 1 at 0x10000394: file main.c, line 11. (gdb) run Starting program: /home/gabi/test_appz/bluebird/bb Value 0 Breakpoint 1, main (argc=1, argv=0x2ff228d4) at main.c:11 11 i++; (gdb) print i No symbol "i" in current context. (gdb) display i No symbol "i" in current context. (gdb) next 9 printf("Value %d\n", i); (gdb) next Value 1 ====================================================================== I noticed 2 different behaviors for these type of variables in 2 different programs: a. The "No symbol in current context" message. b. Wrong value printed out. The symbol is found but the value that is printed out is not correct. Is this a known issue or am I doing something wrong? ---------------------------------------------------------------------- 2. Compilation of gdb 6.4 on AIX 5.2 I try to solve the problems noticed at #1 by trying out the latest version of gdb (6.4) on AIX. I try to compile it with the following: $ gcc -v Reading specs from /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/specs Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++ --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.2.0.0 Thread model: aix gcc version 3.3.2 The compilation stops at the final stage of link-editing: ====================================================================================== config.status: creating Makefile make[2]: Entering directory `/home/gabi/temp/gdb-6.4/sim' make[3]: Entering directory `/home/gabi/temp/gdb-6.4/sim/ppc' CONFIG_FILES= CONFIG_HEADERS=config.h:config.in /bin/sh ./config.status config.status: creating config.h config.status: config.h is unchanged config.status: executing default commands # The first for loop is to remove duplicates. f=""; \ for i in hw_cpu.c hw_memory.c hw_nvram.c hw_iobus.c hw_htab.c hw_disk.c hw_trace.c hw_register.c hw_vm.c hw_init.c hw_core.c hw_pal.c hw_com.c hw_eeprom.c hw_opic.c hw_glue.c hw_phb.c hw_ide.c ; do \ case " $f " in \ *" $i "*) ;; \ *) f="$f $i" ;; \ esac ; \ done ; \ for hw in $f ; do echo $hw ; done \ | sed -e 's/^.*\(hw_.*\)\.c/\1/' \ -e 's/^/extern const device_descriptor /' \ -e 's/$/_device_descriptor\[\];/' \ > tmp-hw.h f=""; \ for i in hw_cpu.c hw_memory.c hw_nvram.c hw_iobus.c hw_htab.c hw_disk.c hw_trace.c hw_register.c hw_vm.c hw_init.c hw_core.c hw_pal.c hw_com.c hw_eeprom.c hw_opic.c hw_glue.c hw_phb.c hw_ide.c ; do \ case " $f " in \ *" $i "*) ;; \ *) f="$f $i" ;; \ esac ; \ done ; \ for hw in $f ; do echo $hw ; done \ | sed -e 's/^.*\(hw_.*\)\.c/\1/' \ -e 's/^/ /' \ -e 's/$/_device_descriptor,/' \ > tmp-hw.c /bin/sh ../.././sim/ppc/../../move-if-change tmp-hw.h hw.h /bin/sh ../.././sim/ppc/../../move-if-change tmp-hw.c hw.c touch tmp-hw # The first for loop is to remove duplicates. f=""; \ for i in pk_disklabel.c ; do \ case " $f " in \ *" $i "*) ;; \ *) f="$f $i" ;; \ esac ; \ done ; \ for pk in $f ; do echo $pk ; done \ | sed -e 's/^.*pk_\(.*\)\.c/\1/' \ -e 's/^/extern package_create_instance_callback pk_/' \ -e 's/$/_create_instance;/' \ > tmp-pk.h /bin/sh ../.././sim/ppc/../../move-if-change tmp-pk.h pk.h touch tmp-pk sed -n -e '/^#define HAVE_/s/ 1$/",/' -e '/^#define HAVE_/s//"HAVE_/p' < config.h > tmp-defines.h /bin/sh ../.././sim/ppc/../../move-if-change tmp-defines.h defines.h touch tmp-defines gcc -I. -I../common -I../.././sim/ppc/../common -o gentmap ../common/gentmap.c rm -f tmp-vals.h ./gentmap -h > tmp-vals.h /bin/sh ../.././sim/ppc/../../move-if-change tmp-vals.h targ-vals.h rm -f tmp-map.c ./gentmap -c > tmp-map.c /bin/sh ../.././sim/ppc/../../move-if-change tmp-map.c targ-map.c gcc -c -g -O2 -DDEFAULT_INLINE=PSIM_INLINE_LOCALS -DWITH_HOST_BYTE_ORDER=BIG_ENDIAN -DWITH_SMP=5 -DHAVE_TERMIO_STRUCTURE -DHAVE_TERMIO_CLINE -DHAVE_DEVZERO -I. -I../.././sim/ppc -I../.././sim/ppc/../../include -I../../bfd -I../.././sim/ppc/../../bfd -I../../gdb -I../.././sim/ppc/../../gdb -I../.././sim/ppc/../../gdb/config -I../../intl -I../.././sim/ppc/../../intl -DHAVE_COMMON_FPU -I../common -I../.././sim/ppc/../common '-DOPCODE_RULES="dc-complex"' '-DIGEN_FLAGS=" -E -F 32,f,o -CSRI 1024 -N 5 "' '-DDGEN_FLAGS=""' options.c rm -f libsim.a ar rc libsim.a debug.o filter_filename.o bits.o sim-endian.o os_emul.o emul_generic.o emul_bugapi.o emul_chirp.o emul_netbsd.o emul_unix.o registers.o vm.o corefile.o model.o spreg.o cpu.o interrupts.o events.o cap.o device.o tree.o device_table.o itable.o mon.o icache.o semantics.o idecode.o support.o sim-fpu.o psim.o pk_disklabel.o hw_cpu.o hw_memory.o hw_nvram.o hw_iobus.o hw_htab.o hw_disk.o hw_trace.o hw_register.o hw_vm.o hw_init.o hw_core.o hw_pal.o hw_com.o hw_eeprom.o hw_opic.o hw_glue.o hw_phb.o hw_ide.o options.o gdb-sim.o sim_calls.o callback.o targ-map.o ranlib libsim.a gcc -g -O2 -o psim main.o libsim.a ../../bfd/libbfd.a ../../libiberty/libiberty.a rm -f run ln psim run make[3]: Leaving directory `/home/gabi/temp/gdb-6.4/sim/ppc' make[3]: Entering directory `/home/gabi/temp/gdb-6.4/sim/common' make[3]: Nothing to be done for `default'. make[3]: Leaving directory `/home/gabi/temp/gdb-6.4/sim/common' make[2]: Leaving directory `/home/gabi/temp/gdb-6.4/sim' make[2]: Entering directory `/home/gabi/temp/gdb-6.4/gdb' CONFIG_HEADERS=config.h:config.in /bin/sh config.status config.status: creating Makefile config.status: creating .gdbinit config.status: creating config.h config.status: config.h is unchanged config.status: linking .././gdb/config/rs6000/tm-rs6000.h to tm.h config.status: linking .././gdb/config/powerpc/nm-aix.h to nm.h config.status: executing default commands rm -f version.c-tmp version.c echo '#include "version.h"' >> version.c-tmp echo 'const char version[] = "'"`sed q .././gdb/version.in`"'";' >> version.c-tmp echo 'const char host_name[] = "powerpc-ibm-aix5.2.0.0";' >> version.c-tmp echo 'const char target_name[] = "powerpc-ibm-aix5.2.0.0";' >> version.c-tmp mv version.c-tmp version.c gcc -c -g -O2 -I. -I.././gdb -I.././gdb/config -DLOCALEDIR="\"/opt/gdb_6.4/share/locale\"" -DHAVE_CONFIG_H -I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd -I.././gdb/../bfd -I.././gdb/../include -I../intl -I.././gdb/../intl -DMI_OUT=1 -DTUI=1 -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral -Wunused-label -Wunused-function -Wuninitialized version.c Making init.c gcc -c -g -O2 -I. -I.././gdb -I.././gdb/config -DLOCALEDIR="\"/opt/gdb_6.4/share/locale\"" -DHAVE_CONFIG_H -I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd -I.././gdb/../bfd -I.././gdb/../include -I../intl -I.././gdb/../intl -DMI_OUT=1 -DTUI=1 -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral -Wunused-label -Wunused-function -Wuninitialized init.c rm -f libgdb.a ar q libgdb.a rs6000-tdep.o xcoffread.o ppc-sysv-tdep.o solib.o solib-svr4.o ser-base.o ser-unix.o ser-pipe.o ser-tcp.o fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o xcoffread.o xcoffsolib.o remote.o dcache.o remote-utils.o tracepoint.o ax-general.o ax-gdb.o remote-fileio.o cli-dump.o cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o cli-logging.o cli-interp.o mi-out.o mi-console.o mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-interp.o mi-main.o mi-parse.o mi-getopt.o mi-common.o aix-thread.o tui-command.o tui-data.o tui-disasm.o tui-file.o tui.o tui-hooks.o tui-interp.o tui-io.o tui-layout.o tui-out.o tui-regs.o tui-source.o tui-stack.o tui-win.o tui-windata.o tui-wingeneral.o tui-winsource.o c-exp.o cp-name-parser.o objc-exp.o ada-exp.o jv-exp.o f-exp.o m2-exp.o p-exp.o version.o annotate.o auxv.o bfd-target.o blockframe.o breakpoint.o findvar.o regcache.o charset.o disasm.o dummy-frame.o source.o value.o eval.o valops.o valarith.o valprint.o printcmd.o block.o symtab.o symfile.o symmisc.o linespec.o dictionary.o infcall.o infcmd.o infrun.o expprint.o environ.o stack.o thread.o exceptions.o inf-child.o interps.o main.o macrotab.o macrocmd.o macroexp.o macroscope.o event-loop.o event-top.o inf-loop.o completer.o gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o memattr.o mem-break.o target.o parse.o language.o buildsym.o std-regs.o signals.o kod.o kod-cisco.o gdb-events.o exec.o bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o dbxread.o coffread.o coff-pe-read.o elfread.o dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o dwarf2expr.o dwarf2loc.o dwarf2-frame.o ada-lang.o c-lang.o f-lang.o objc-lang.o ui-out.o cli-out.o varobj.o wrapper.o jv-lang.o jv-valprint.o jv-typeprint.o m2-lang.o p-lang.o p-typeprint.o p-valprint.o scm-exp.o scm-lang.o scm-valprint.o sentinel-frame.o complaints.o typeprint.o ada-typeprint.o c-typeprint.o f-typeprint.o m2-typeprint.o ada-valprint.o c-valprint.o cp-valprint.o f-valprint.o m2-valprint.o nlmread.o serial.o mdebugread.o top.o utils.o ui-file.o user-regs.o frame.o frame-unwind.o doublest.o frame-base.o gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o cp-namespace.o reggroups.o regset.o trad-frame.o tramp-frame.o solib.o solib-null.o inflow.o init.o ranlib libgdb.a rm -f gdb gcc -g -O2 -Wl,-bbigtoc -lpthdebug \ -o gdb gdb.o libgdb.a \ ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a ../libiberty/libiberty.a -lcurses -liconv ../libiberty/libiberty.a ld: 0711-317 ERROR: Undefined symbol: .pow ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: ld returned 8 exit status make[2]: *** [gdb] Error 1 make[2]: Leaving directory `/home/gabi/temp/gdb-6.4/gdb' make[1]: *** [all-gdb] Error 2 make[1]: Leaving directory `/home/gabi/temp/gdb-6.4' make: *** [all] Error 2 ====================================================================================== Is this a known issue any workarounds? Does one of the releases 6.0 -> 6.4 solve the problem described at #1. I tried also compiling 6.3 from sources but it stops at a previous step (some dependency in gettext if i remember correctly). gabriel -- Petchesi Gabriel Horatiu E-mail: gabi@prolix.ro