unable to display the souce line in gdb


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers unable to display the souce line in gdb
# 1  
Old 01-16-2006
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
# 2  
Old 01-16-2006
Some of the things which need to be done before your run your application in gdb.

Make sure the application is compiled with the -ggdb flag. Minimally the -g flag should be there. None of -O flags should be present.

Try running your app and see if you can see the source code displayed.
# 3  
Old 01-16-2006
Hi Vino,

Thanks for the reply. But i have just exe file. How can i check these flags in a complied version.

Thanks & Regards
Gauri
# 4  
Old 04-19-2007
Hi, does anyone know how can I skip a loop 'n' number of times in gdb.

For e.g:

for (i= 0; i< 100; i++) {
...
}

Lets say I am single stepping the program and I reach this loop. Now I want to skip running the loop 10 times. (I do not want to single step inside the loop for the first 10 iterations)

Can I do that ?

Thank you !!
# 5  
Old 04-19-2007
You should have created a new thread for this as it is a new topic. The simplest solution I can think of is to use a conditional breakpoint, where you would set the condition based on the value of i.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

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 Breakpoint 1, TestCode (handler=0x806e110,... (1 Reply)
Discussion started by: rupeshkp728
1 Replies

2. UNIX for Dummies Questions & Answers

Display Date and Time in GDB

In gdb is there any way we can display date/time in first column while debugging or is there any command which will print date/time? I am asking this just to know when exactly a breakpoint got hit. (6 Replies)
Discussion started by: rupeshkp728
6 Replies

3. 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

4. Linux

unable to read core dumps on unix. Is there another way than using GDB?

hi all, I am having set of core dumps obtained from client server. Now i am trying to read them but unable to do so. I have few queries: 1. Core dumps were generated on some xyz server and copied to my unix virtual. Can I read them as text here? 2. I tried installing gdb-7.3 but when i fire... (0 Replies)
Discussion started by: suyogs
0 Replies

5. 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

6. Shell Programming and Scripting

Copy a file by creating folder structure in destination as in Souce

Hello, i am having a source directory which consist of multiple sub directories and my destination folder is a empty directory. if try to copy a file source->test->1.txt from source to destination test2 using the commaind. cp source/test/1.txt desti/ It will copy the 1.txt under desti... (1 Reply)
Discussion started by: tsaravanan
1 Replies

7. 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

8. Shell Programming and Scripting

Unable to display correctly the contents of a file without a line feed

I am using AIX and ksh. I need to display the contents of a file that has a pid (process id). Because the file is open, it doesn't have the line feed or new line, so for some reason if I do this: `cat $pid` , where $pid is the name of the fully qualified file, it displays test3.sh: 426110:... (1 Reply)
Discussion started by: Gato
1 Replies

9. Programming

Incorrect address display by GDB

Hi, On using GDB debugger on different executables, the address displayed for the symbols seem incorrect, as it shows me the same address in each prorgram, run simultaneoulsy. eg: Program: linkmain1.c Breakpoint 1, main () at linkmain1.c:14 14 printf("In linkmain1.c\n"); (gdb)... (0 Replies)
Discussion started by: karthikb23
0 Replies

10. UNIX for Advanced & Expert Users

xhost unable to open display

I am trying to install ORACLE 10g database on HP-UNIX 11.11 I am running OUI runinstaller from exceed terminal from windows PC. I have set DISPLAY=IPAddress of PC:0.0 When installer starts it is giving me error of display (5 Replies)
Discussion started by: ymg
5 Replies
Login or Register to Ask a Question