Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-23-2011, 12:31 PM
|
#1
|
LQ Newbie
Registered: Jan 2011
Posts: 4
Rep:
|
Others have gdb debug symbols but I don't...
Using the same platform and the same code compiled with -g
My teammate can logon build the source, run, create a core file
>gdb Exename core.exename.pid
gdb> where
produces a backtrace to the line that the error occurred.
I login and build the same source, run, create a core file
>gdb Exename core.exename.pid
gdb> where
gives me minimal info as if I have no symbols loaded.
Checked our .bashrc and env for differences but find none. What? I give up!
|
|
|
01-23-2011, 09:37 PM
|
#2
|
Senior Member
Registered: Dec 2008
Posts: 4,732
|
Try this: http://www.delorie.com/gnu/docs/gdb/gdb_125.html
The following quote is from above link:
Quote:
file filename
Use filename as the program to be debugged. It is read for its symbols and for the contents of pure memory.
|
|
|
|
01-24-2011, 08:27 AM
|
#3
|
LQ Newbie
Registered: Jan 2011
Posts: 4
Original Poster
Rep:
|
I will look at the provided link. However, remember that nothing is different except that I login to my account and my teammate logs into their account. They can get useful debug information, I can't. The Exe has the debug info built into it at compile time right? So I understand you are saying use the file command but typically this is not necessary
|
|
|
01-24-2011, 08:28 AM
|
#4
|
Senior Member
Registered: Dec 2008
Posts: 4,732
|
Quote:
Originally Posted by williawh
So I understand you are saying use the file command but typically this is not necessary
|
Yes, but there is no harm in trying since the cause of the problem is unknown!
|
|
|
01-25-2011, 10:39 AM
|
#5
|
LQ Newbie
Registered: Jan 2011
Posts: 4
Original Poster
Rep:
|
Good point Anisha.
The following are my environment variables minus the ones I thought were irrelevant to this topic:
SHELL=/bin/bash
KDE_NO_IPV6=1
GTK_RC_FILES=/etc/gtk/gtkrc:/home/williawh/.gtkrc-1.2-gnome2
QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
USER=williawh
LD_LIBRARY_PATH=/opt/Xilinx/10.1/ISE/lib/lin64:/usr/X11R6/lib:/opt/Xilinx/10.1/ISE/smartmodel/lin64/installed_lin64:/opt/Xilinx/10.1/ISE/smartmodel/lin64/installed_lin64/lib/linux.lib:/opt/Xilinx/10.1/ISE/smartmodel/lin64/installed_lin64:/opt/Xilinx/10.1/ISE/smartmodel/lin64/installed_lin64/lib/amd64.lib:/opt/Xilinx/10.1/EDK/lib/lin64:/opt/Xilinx/10.1/ISE/lib/lin64:/usr/X11R6/lib:/opt/Xilinx/10.1/ISE/smartmodel/lin64/installed_lin64/lib/linux.lib:/opt/Xilinx/10.1/ISE/smartmodel/lin64/installed_lin64/lib/amd64.lib:/opt/Xilinx/10.1/EDK/lib/lin64
DEPMOD=/opt/eldk/usr/bin/depmod.pl
XILINX_EDK=/opt/Xilinx/10.1/EDK
KDEDIR=/usr
USERNAME=williawh
PATH=/opt/eldk/usr/bin:/opt/eldk/bin:/opt/Xilinx/10.1/EDK/gnu/microblaze/lin64/bin/:/opt/Xilinx/10.1/EDK/gnu/powerpc-eabi/lin64/bin/:/opt/Xilinx/10.1/ISE/bin/lin64:/opt/Xilinx/10.1/EDK/bin/lin64:/opt/Xilinx/10.1/EDK/lib/lin64:/opt/eldk/usr/bin:/opt/eldk/bin:/opt/Xilinx/10.1/EDK/gnu/microblaze/lin64/bin/:/opt/Xilinx/10.1/EDK/gnu/powerpc-eabi/lin64/bin/:/opt/Xilinx/10.1/ISE/bin/lin64:/opt/Xilinx/10.1/EDK/bin/lin64:/opt/Xilinx/10.1/EDK/lib/lin64:/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/williawh/bin
XIL_IMPACT_USE_LIBUSB=1
XMODIFIERS=@im=none
KDE_IS_PRELINKED=1
LANG=en_US.UTF-8
HOME=/home/williawh
LOGNAME=williawh
QTLIB=/usr/lib64/qt-3.3/lib
ARCH=powerpc
CROSS_COMPILE=ppc_4xx-
LMC_HOME=/opt/Xilinx/10.1/ISE/smartmodel/lin64/installed_lin64:/opt/Xilinx/10.1/ISE/smartmodel/lin64/installed_lin64
XILINX=/opt/Xilinx/10.1/ISE
I am compiling to a xilinx powerpc 405 processor board using eldk provided from xilinx using the following Makefile:
PROJ = TEPCdacq
OBJS = Dacq.o ProcessCmd.o Calculation.o Logging.o FPGA_Sim.o\
Analog_Voltage.o Detector.o High_Voltage.o Power.o Pulser.o
LIBS =
CFLAGS =-Wall
CDEFS =
TEPC_DIR = ../..
TEPC_APPS_DIR = $(TEPC_DIR)/apps
TEPC_INCLUDE_DIR = $(TEPC_APPS_DIR)/include
ANALOG_INCLUDE_DIR = $(TEPC_DIR)/modules/analog
DETECTOR_INCLUDE_DIR = $(TEPC_DIR)/modules/detector
HIVOLT_INCLUDE_DIR = $(TEPC_DIR)/modules/hivolt
POWER_INCLUDE_DIR = $(TEPC_DIR)/modules/power
PULSER_INCLUDE_DIR = $(TEPC_DIR)/modules/pulser
PROCESSOR_INCLUDE_DIR = $(TEPC_DIR)/modules/pboard
INCLUDES = -I.
INCLUDES += -I$(TEPC_INCLUDE_DIR)
INCLUDES += -I$(ANALOG_INCLUDE_DIR)
INCLUDES += -I$(DETECTOR_INCLUDE_DIR)
INCLUDES += -I$(HIVOLT_INCLUDE_DIR)
INCLUDES += -I$(POWER_INCLUDE_DIR)
INCLUDES += -I$(PULSER_INCLUDE_DIR)
INCLUDES += -I$(PROCESSOR_INCLUDE_DIR)
DEBUG_MODE = 1
ifeq ($(DEBUG_MODE),1)
CC = $(CROSS_COMPILE)gcc -g
CPLUS = $(CROSS_COMPILE)g++ -g
else
CC = $(CROSS_COMPILE)gcc -O3
CPLUS = $(CROSS_COMPILE)g++ -O3
endif
RM = rm -rf
AR = $(CROSS_COMPILE)ar crus
all: exec
default: exec
DEPS = $(OBJS:.o=.d)
-include $(DEPS)
exec: $(PROJ)
-cp ${PROJ} /opt/eldk/ppc_4xx/home/shared/.
%.o : %.c
$(CC) -M $(CFLAGS) $(INCLUDES) $(CDEFS) -o $*.d $<
$(CC) $(CFLAGS) $(INCLUDES) $(CDEFS) -o $@ -c $<
%.o : %.cpp
$(CPLUS) -M $(CFLAGS) $(INCLUDES) $(CDEFS) -o $*.d $<
$(CPLUS) $(CFLAGS) $(INCLUDES) $(CDEFS) -o $@ -c $<
$(PROJ): $(OBJS)upgrade: $(PROJ)
mkdir tepc_upgrade
cp $(PROJ) $(PROJ).md5 tepc_upgrade/
tar cvzf tepc_upgrade.tgz tepc_upgrade/
rm -rf tepc_upgrade/
clean:
rm -rf ${PROJ} core core.* *.o *.d temp.* *.out typescript* *.md5 tepc_upgrade.tgz tepc_upgrade/
-rm -f /opt/eldk/ppc_4xx/home/shared/${PROJ}
edit-clean : clean
$(RM) *~
$(CPLUS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) -lm
md5sum $(PROJ) > $(PROJ).md5
The produced output from the makefile is as follows:
[williawh@tepc-edev data_acq]$ make
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Dacq.d Dacq.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Dacq.o -c Dacq.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o ProcessCmd.d ProcessCmd.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o ProcessCmd.o -c ProcessCmd.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Calculation.d Calculation.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Calculation.o -c Calculation.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Logging.d Logging.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Logging.o -c Logging.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o FPGA_Sim.d FPGA_Sim.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o FPGA_Sim.o -c FPGA_Sim.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Analog_Voltage.d Analog_Voltage.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Analog_Voltage.o -c Analog_Voltage.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Detector.d Detector.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Detector.o -c Detector.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o High_Voltage.d High_Voltage.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o High_Voltage.o -c High_Voltage.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Power.d Power.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Power.o -c Power.c
ppc_4xx-gcc -g -M -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Pulser.d Pulser.c
ppc_4xx-gcc -g -Wall -I. -I../../apps/include -I../../modules/analog -I../../modules/detector -I../../modules/hivolt -I../../modules/power -I../../modules/pulser -I../../modules/pboard -o Pulser.o -c Pulser.c
ppc_4xx-g++ -g -Wall -o TEPCdacq Dacq.o ProcessCmd.o Calculation.o Logging.o FPGA_Sim.o Analog_Voltage.o Detector.o High_Voltage.o Power.o Pulser.o -lm
md5sum TEPCdacq > TEPCdacq.md5
cp TEPCdacq /opt/eldk/ppc_4xx/home/shared/.
The exe is copied to a share folder that is NFS mounted on the target.
I run the code and get a core core.TEPCdacq.870:
/aridata/bin # gdb TEPCdacq core.TEPCdacq.870
GNU gdb Red Hat Linux (6.7-1rh)
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "ppc-linux"...
Using host libthread_db library "/mnt/lib/libthread_db.so.1".
warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/libstdc++.so.6...done.
Loaded symbols for /lib/libstdc++.so.6
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld.so.1...done.
Loaded symbols for /lib/ld.so.1
Core was generated by `TEPCdacq'.
Program terminated with signal 11, Segmentation fault.
#0 0x3969fffc in ?? ()
(gdb) where
#0 0x3969fffc in ?? ()
Cannot access memory at address 0x801e8104
(gdb)
Doing it the way you suggested... If this is not what you mean please let me know...:
/aridata/bin # gdb
GNU gdb Red Hat Linux (6.7-1rh)
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "ppc-linux".
(gdb) file TEPCdacq
Reading symbols from /aridata/bin/TEPCdacq...done.
Using host libthread_db library "/mnt/lib/libthread_db.so.1".
(gdb) core-file core.TEPCdacq.87
/aridata/bin/core.TEPCdacq.87: No such file or directory.
(gdb) core-file core.TEPCdacq.870
warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/libstdc++.so.6...done.
Loaded symbols for /lib/libstdc++.so.6
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld.so.1...done.
Loaded symbols for /lib/ld.so.1
Core was generated by `TEPCdacq'.
Program terminated with signal 11, Segmentation fault.
#0 0x3969fffc in ?? ()
(gdb) where
#0 0x3969fffc in ?? ()
Cannot access memory at address 0x801e8104
(gdb)
I copy the core file to the shared folder:
/aridata/bin # cp core.TEPCdacq.870 /mnt/home/shared/
/aridata/bin # mount
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw)
proc on /proc type proc (rw)
/dev/xsa2 on /aridata type ext3 (rw,errors=continue,data=ordered)
192.168.1.1:/opt/eldk/ppc_4xx on /mnt type nfs (rw,vers=3,rsize=32768,wsize=32768,namlen=255,hard,nointr,proto=udp,timeo=7,retrans=3,sec=sys,addr=1 92.168.1.1)
/aridata/bin #
I then copy it to the directory I built the source in and run the target debugger: (no joy :| nundeskut!!!)
[williawh@tepc-edev data_acq]$ pwd
/home/williawh/workspace/trunk/tepc_software/apps/data_acq
[williawh@tepc-edev data_acq]$ cp /opt/eldk/ppc_4xx/home/shared/core.TEPCdacq.870 .
cp: cannot open `/opt/eldk/ppc_4xx/home/shared/core.TEPCdacq.870' for reading: Permission denied
[williawh@tepc-edev data_acq]$ cp /opt/eldk/ppc_4xx/home/shared/core.TEPCdacq.870 .
[williawh@tepc-edev data_acq]$ whereis ppc_4xx-gdb
ppc_4xx-gdb:
[williawh@tepc-edev data_acq]$ which ppc_4xx-gdb
/opt/eldk/usr/bin/ppc_4xx-gdb
[williawh@tepc-edev data_acq]$ /opt/eldk/usr/bin/ppc_4xx-gdb
GNU gdb Red Hat Linux (6.7-1rh)
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=ppc-linux".
The target architecture is set automatically (currently powerpc:403)
(gdb) file TEPCdacq
Reading symbols from /home/williawh/workspace/trunk/tepc_software/apps/data_acq/TEPCdacq...done.
(gdb) core-file core.TEPCdacq.870
warning: Can't read pathname for load map: Input/output error.
Reading symbols from /opt/eldk/ppc_4xx/lib/libstdc++.so.6...done.
Loaded symbols for /opt/eldk/ppc_4xx/lib/libstdc++.so.6
Reading symbols from /opt/eldk/ppc_4xx/lib/libm.so.6...done.
Loaded symbols for /opt/eldk/ppc_4xx/lib/libm.so.6
Reading symbols from /opt/eldk/ppc_4xx/lib/libgcc_s.so.1...done.
Loaded symbols for /opt/eldk/ppc_4xx/lib/libgcc_s.so.1
Reading symbols from /opt/eldk/ppc_4xx/lib/libc.so.6...done.
Loaded symbols for /opt/eldk/ppc_4xx/lib/libc.so.6
Reading symbols from /opt/eldk/ppc_4xx/lib/ld.so.1...done.
Loaded symbols for /opt/eldk/ppc_4xx/lib/ld.so.1
Core was generated by `TEPCdacq'.
Program terminated with signal 11, Segmentation fault.
#0 0x3969fffc in ?? ()
(gdb) where
#0 0x3969fffc in ?? ()
Cannot access memory at address 0x801e8104
(gdb) quit
aaaaarrrrrgggggggghhhhhhhhhhhhhhhh! I contacted the system guru. He says "well you must be doing something different... good grief :O !!!
|
|
|
01-25-2011, 11:48 AM
|
#6
|
Senior Member
Registered: Dec 2008
Posts: 4,732
|
I couldn't properly read your outputs since you didn't use the [code] tags, see what I get by the following commands, try the exact same commands on a simple program like hello.c, and compare the outputs:
Code:
anisha@linux-dpjj:~/Desktop> gcc -Wall -Wextra hello.c -g
anisha@linux-dpjj:~/Desktop> gdb ./a.out
....
Reading symbols from /home/anisha/Desktop/a.out...done.
(gdb) file ./a.out
Load new symbol table from "/home/anisha/Desktop/a.out"? (y or n) y
Reading symbols from /home/anisha/Desktop/a.out...done.
(gdb) b main
Breakpoint 1 at 0x804845d: file check.c, line 5.
(gdb) r
Starting program: /home/anisha/Desktop/a.out
Missing separate debuginfo for /lib/ld-linux.so.2
Try: zypper install -C "debuginfo(build-id)=d7706cbaa0ca09319cb645eac789cb8399078797"
Missing separate debuginfo for /lib/libc.so.6
Try: zypper install -C "debuginfo(build-id)=ee302691046515fe3766ae3b7d47afd3e3a8d063"
Breakpoint 1, main () at check.c:5
5 char *buff[]={"ram","shayam","hari"};
(gdb) generate-core-file ./a.out
Saved corefile ./a.out
(gdb) core-file a.out
A program is being debugged already. Kill it? (y or n) y
"/home/anisha/Desktop/a.out": not in executable format: File format not recognized
(gdb) core-file a.out
Core was generated by `/home/anisha/Desktop/a.out'.
Program terminated with signal 5, Trace/breakpoint trap.
#0 main () at check.c:5
5 char *buff[]={"ram","shayam","hari"};
(gdb)
Last edited by Aquarius_Girl; 01-25-2011 at 12:06 PM.
|
|
|
01-26-2011, 08:52 AM
|
#7
|
LQ Newbie
Registered: Jan 2011
Posts: 4
Original Poster
Rep:
|
could you send me the exact code you used please?
|
|
|
01-26-2011, 08:55 AM
|
#8
|
Senior Member
Registered: Dec 2008
Posts: 4,732
|
Which code are you talking of? You must not be asking me to paste here a 'hello.c' of course!
|
|
|
All times are GMT -5. The time now is 01:56 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|