GDB not showing line details


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers GDB not showing line details
# 1  
GDB not showing line details

I have bunch of source code which I compiled using -ggdb3 flag.
I have copied the source code and executable to an another machine.
When I run the exe in gdb it does not show the statments at the line numbers when it breaks.

This is what I see
Code:
Breakpoint 1, TestCode (handler=0x806e110, args=0xffffd2b0)
    at ../myfile.c:1080
1080    ../myfile.c: No such file or directory.
(gdb) n
1083    in ../myfile.c
(gdb) 
1084    in ../myfile.c
(gdb) 
1085    in ../myfile.c

I even tried setting the dir path using gdb dir command by giving the name of the topmost directory of the source code but no help.

Any way to resolve this issue?

I even tried setting the dir path using gdb dir command by giving the name of the topmost directory of the source code but no help. Example my source code directory structure is like
Code:
            C
            |
         --------------
        |                  |
        D               E
        |
        F
        |
   -----------
  |               |
  S             T

The file I am debugging may be in some inner folder say F. While I gave the path of folder C in gdb dir
Code:
dir /home/C

More details are:
Code:
> OS SUSE Linux Enterprise Server 11 (x86_64)
> gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) 
> GNU gdb (GDB) SUSE (7.5.1-0.7.29)

Here are the Makefile details
Code:
#
# Makefile for building demo code on SUSE Linux

all : SLIBINSTALLDIR = $(SDESTDIR)$(SLIBDIR)

###########################################
#               Defines                   #
###########################################

CC = --mode=compile gcc
LINK =$(DESTDIR)libtool --mode=link gcc
INDEPSDIR = ../../../../../dependencies/internal
MODULE = TestCode

INCLUDE = -I../ -I$(INDEPSDIR)/include
CFLAGS := $(CFLAGS) $(INCLUDE)  -DN_PLAT_UNIX -DN_PLAT_GNU -DVERSION=0x00010002 -D_GNU_SOURCE -g -ggdb3


CSRC  = ../myfile.c ../decode.c  ../encode.c
COBJ = $(CSRC:.c=.o)
COBJ1 = $(CSRC:.c=.lo)

TestCode:$(COBJ)
         $(LINK) $(CFLAGS)  -o TestCode $(COBJ1) -all-static 

DESRC  = ../main.c
DEOBJ = $(DESRC:.c=.o)

If the add the full path of each file in gdb dir then it show proper line details. But adding each and every file name in dir is tedious.

Last edited by rupeshkp728; 06-06-2014 at 02:15 PM.. Reason: more details added
# 2  
It is looking for the source file in ../. It's going to be looking one dir up from wherever you tell it.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #991
Difficulty: Medium
System V was known inside Bell Labs as Unix 6.0.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Syntax error from cshrc, but not showing line number

Hi, I have been using ksh till now but was forced to use tcsh from last few days. I am getting a gvimrc error which says "set: Syntax error". What makes this pesky is that it is not showing which line number is the error from. How do I get the line number of the error? Also, I am using the... (11 Replies)
Discussion started by: rishikpillai90
11 Replies

2. Programming

Why does gdb stop at a different line than i b shows while returning from function?

Here is the program I am trying to debug: #include <stdio.h> int i = 5; int main(void) { int x = 3; display(x); return 0; } void display(int x) { for ( i=0; i<x; ++i ) { printf("i is %d.\n", i); } }This code is coming from here Peter's gdb Tutorial: Stepping... (2 Replies)
Discussion started by: ijustneeda
2 Replies

3. UNIX for Dummies Questions & Answers

at -l doesnt give details of the scheduled job. How to get the details?

I have scheduled couple of shell scripts to run using 'at' command. The o/p of at -l is: $ at -l 1320904800.a Thu Nov 10 01:00:00 2011 1320894000.a Wed Nov 9 22:00:00 2011 1320876000.a Wed Nov 9 17:00:00 2011 $ uname -a SunOS dc2prcrptetl2 5.9 Generic_122300-54 sun4u sparc... (2 Replies)
Discussion started by: superparticle
2 Replies

4. Programming

GDB No line in file error

Hi, I have a c program i compile with gcc4.5. This elf, if I use gdb and put a breakpoint on main, instead has a breakpoint in a function other than main or says no line in file. I verified the elf is 1 to 1 with source, have all debug symbols for compilation etc. The problem I think is the... (2 Replies)
Discussion started by: dragonpoint
2 Replies

5. Shell Programming and Scripting

how to check which line of the script is showing the error

how to check which line of the script is showing the error... like -x will print each output in stdout... but want to know exact error line trowing error.. (2 Replies)
Discussion started by: mail2sant
2 Replies

6. Programming

gdb: how to debug an executable file with a few command line papameters

If an executalbe file has several parameters, gdb can not pass parameters correctly. Let us see: run: ./executablefile1 agr1 arg2 arg3 debug: gdb executablefile1 run executalbefile1 arg1 arg2 arg3 then argv : executablefile1 argv : executablefile argv : arg1 ... (3 Replies)
Discussion started by: cdbug
3 Replies

7. UNIX for Dummies Questions & Answers

unable to display the souce line in gdb

Hi All, I am unable to display the code in gdb. When i put list command i dont get any line. I mean i am unable to display the source line in gdb. Can any body help me. Thanks & Regards Gauri (4 Replies)
Discussion started by: gauri
4 Replies

8. Filesystems, Disks and Memory

Showing an extra record/line

Hello everybody, I am working on ETL side. My job is to load the data from Oracle table to flat file and from flat file to oracle table using ETL tool Informatica. My flat files are fixed width. In the first phase, it is loading 66351 records into data file through tool. When I checked through... (1 Reply)
Discussion started by: srivsn
1 Replies

9. Shell Programming and Scripting

Showing extra line/record in file

Hello everybody, My job is to load the data from Oracle table to flat file and from flat file to oracle table using ETL tool Informatica. My flat files are fixed width. In the first phase, it is loading 66351 records into data file through tool. When I checked through wc -l <data filename> it is... (1 Reply)
Discussion started by: srivsn
1 Replies

Featured Tech Videos