gdb not found


 
Thread Tools Search this Thread
Top Forums Programming gdb not found
# 1  
Old 09-24-2010
gdb not found

Hello,

I am having problem with debugging my code. I am writing a C code and then I compile it with the Makefile. I make a target file and then copy it in my Robot(Khepera III) and then run the program over there.

I compile it ofcorse on my machine and then copy the compiled file in the robot.

I am having problem with debugging the code. I am writing it the code on the vi editor and wants to run GDB debugger to debug the code , as I have no other way to do it.

But the GDB debugger seem to run on the executable file. I compile it using the target file , n then if am using the .o file to run in the gdb debugger, it says:

"executable file not found"

I am having hard time to debug this code Smilie

Can anyone please suggest me, how I cna efficiently debug my code, as other wise am using printf statements to do that.

But am having hard time to do that way.

I will be really glad if someone can suggest me other way or some solution to it.

Thanks a tonn in advance.

Regards
# 2  
Old 09-24-2010
If I understand your post, you are not using gdb correctly.
With no robot, compile your code.
cd to that directory, where your code and source currently are.
Code:
gdb mycode
gdb> br main           <- start debugging at the first line in main
gdb> r  [any arguments to the code go here just like you would type them on the command line]

At this point you are in the code. Use the step, list, print to move thru the code, print a variable, show the surrounding lines of code.

IF you have a problem line
Code:
br [problem line num]

. If you have a problem function br
Code:
[function name]

Any time you want to quit: type q and answer y, for help: type help.
# 3  
Old 09-24-2010
Quote:
Originally Posted by mind@work
I am having problem with debugging the code. I am writing it the code on the vi editor and wants to run GDB debugger to debug the code , as I have no other way to do it.

But the GDB debugger seem to run on the executable file. I compile it using the target file , n then if am using the .o file to run in the gdb debugger, it says:

"executable file not found"

I am having hard time to debug this code Smilie
.o files are not executable files. You can't run them in any fashion, gdb or not. They're just intermediate files the linker uses to build the actual executable.
# 4  
Old 09-24-2010
Thank you Jim for replying.

I am running the gdb debugger as u said, but the gdb says the following:

gdb>
Starting program:
No executable file specified.

(I make a Makefile in which it is getting compiled n then it make a target file which gets copied to the robot. I had to do so....coz it had some libraries which needed to be compiled for the robots which were not supported by gnu)

So now after that it sees the file, but it doesn't see the executable file.

So am not sure if this debugger would even work in this case or not.
# 5  
Old 09-24-2010
So you copy the executable file to the robot, and run the debugger on the robot? Can you ldd filename on the robot to see if there's perhaps any shared libraries missing, etc?

You should be able to gdb anything, though symbols may not be available for proprietary things not built with debugging support.

"no executable file specified" is an odd error. Are you specifying the file on the commandline? "gdb ./filename", not just "gdb"? Sometimes weird error messages can happen from dynamic link problems, but...
# 6  
Old 09-24-2010
@Corona688:

I tried to run gdb both on my machine and on the robot.

ON my machine it is giving me the problem, I just talked about and on the robot it is saying the following:

-sh: gdb: not found.

so am prob. thinking of installing gdb on my robot, if there is any way, but not sure if it will work at all.

and also am running gdb by : gdb filename
# 7  
Old 09-24-2010
to run an executable
Code:
gdb myprogram

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Qemu + gdb

Hi, I got: host machine: RedHat (RHEL6) virtual machine: RedHat (RHEL6) I run (on host machine): qemu-system-x86_64 ...... -S -s after that i run (on host machine): gdb target remote localhost:1234 set architecture i386:x86-64 and then i can use (on host machine) 'ctrl + c' to... (2 Replies)
Discussion started by: Chrisdot
2 Replies

2. Programming

gdb help

i have created some break points in gdb. let's say.... b sqlcxt how can i know the breakpoint name of sqlcxt ??? (1 Reply)
Discussion started by: lipun4u
1 Replies

3. UNIX for Advanced & Expert Users

gdb and ptrace ????

Hi all What 's the relationship between gdb and ptrace, if the kernel does not support ptrace, can gdb work ? Is there some one can explain this for me (3 Replies)
Discussion started by: yanglei_fage
3 Replies

4. UNIX for Advanced & Expert Users

Using Gdb

Hi All, I am trying to execute a binary and it is giving Segmentation Fault. Can I use gdb to debug this error? Secondly there is no core file generated , so when I an trying to run gdb with the binary only I am not able to set any breakpoints. When I am running the gdb and the I am... (1 Reply)
Discussion started by: shubhranshu
1 Replies

5. UNIX for Advanced & Expert Users

Gdb

Hi All, I wanted to know if there is a core file generated and I am not sure for which Binary it is generated . Can I use gdb to debug the core file ? Thanks. (1 Reply)
Discussion started by: shubhranshu
1 Replies

6. UNIX for Advanced & Expert Users

Gdb:

Hi, This is a simple question on GDB. Given a core file, how can you check which process has dumped the core? Regards - Krishna (1 Reply)
Discussion started by: krishnamurthig
1 Replies

7. Solaris

gdb for SunOS 5.6

I want to install gdb on SunOS 5.6 machine. Where can i download from ? (1 Reply)
Discussion started by: shafi2all
1 Replies

8. Shell Programming and Scripting

how can i check in csh if command found or not found ?

hello all im trying to use in sun Solaris the information received from the top command now i several machines that dont have install the top program so when im running the script im geting error saying after im running this code : set MemoryInfo = `top | grep Memory` if (... (2 Replies)
Discussion started by: umen
2 Replies

9. Programming

gdb command

I'm having problem understanding the how to use gdb command to debug my program. Can anyone give me some suggestion how to start, and examples. I read the manual in unix...I'm still confuse. (6 Replies)
Discussion started by: Confuse
6 Replies

10. Programming

GDB or DBX??

Which is better?? I have always been a gdb fan.. But ppl say dbx is beter better for debugging the core.. Do all GDB lovers agree to it??? :cool: (1 Reply)
Discussion started by: jyotipg
1 Replies
Login or Register to Ask a Question