For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > September 2005 > How to debug gcc in Linux









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to debug gcc in Linux
ern

2005-09-20, 7:02 pm

I'm using gcc in Linux to compile my program. Is there a way to step
through the code in some kind of debugger mode? Thanks.

David Schwartz

2005-09-20, 7:02 pm


"ern" <erniedude@gmail.com> wrote in message
news:1127253899.936108.228920@g14g2000cwa.googlegroups.com...

> I'm using gcc in Linux to compile my program. Is there a way to step
> through the code in some kind of debugger mode? Thanks.


Learn all about 'gdb'. It provides stepping, breakpoints, and
post-mortem debugging.

DS


Paul Pluzhnikov

2005-09-20, 10:02 pm

"ern" <erniedude@gmail.com> writes:

> I'm using gcc in Linux to compile my program. Is there a way to step
> through the code in some kind of debugger mode? Thanks.


In addition to "learn gdb" comment, please note that you selected
particularly bad subject for your post: the task that you want to
perform -- debug your own code (the compiler you used to compile
that code is mostly irrelevant) -- has absolutely nothing to do
with debugging gcc (the compiler itself) on Linux.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Luotao Fu

2005-09-21, 3:56 am

Hi,

ern schrieb:
> I'm using gcc in Linux to compile my program. Is there a way to step
> through the code in some kind of debugger mode? Thanks.
>


compile your code with -g flag,
gcc -g project.c -o project

the -g flag produces debug informations on the binary, which is
especially usable for gdb. You can also use some additional flags to
produce debug information in other formats.

After the compilition open the binary with gdb.
gdb project
you'll get a subshell, for the most important commandos on this subshell
(run, break, step, where etc.) pleas read the help. There're also some
GUI tools, ddd i.E. is a nice frontend for gdb.


Have fun
cheers
Luotao Fu
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com