Web Images Groups Books Scholar Blogs Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
gcc compiler - debuging
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
t  
View profile  
 More options Oct 26, 2:21 am
Newsgroups: comp.lang.c++
From: "t" <w...@wp.pl>
Date: Sun, 25 Oct 2009 15:51:26 +0100
Local: Mon, Oct 26 2009 2:21 am
Subject: gcc compiler - debuging
Hi
How to debuge programc in gcc

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ramon  
View profile  
 More options Oct 26, 3:14 am
Newsgroups: comp.lang.c++
From: Ramon <ramif_47.inva...@yahoo.co.uk>
Date: Sun, 25 Oct 2009 16:44:30 +0100
Local: Mon, Oct 26 2009 3:14 am
Subject: Re: gcc compiler - debuging

t wrote:
> Hi
> How to debuge programc in gcc

Use gdb  -- GNU Debugger

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Maxim Yegorushkin  
View profile  
 More options Oct 26, 3:22 am
Newsgroups: comp.lang.c++
From: Maxim Yegorushkin <maxim.yegorush...@gmail.com>
Date: Sun, 25 Oct 2009 15:52:19 +0000
Local: Mon, Oct 26 2009 3:22 am
Subject: Re: gcc compiler - debuging
On 25/10/09 14:51, t wrote:

> Hi
> How to debuge programc in gcc

You need to use a debugger, such as gdb. Google for "gdb tutorial".

Another option is to use some integrated development environment, such
as free ones Eclipse or NetBeans. They may be much easier to start with
for beginners.

--
Max


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jorgen Grahn  
View profile  
 More options Oct 27, 4:27 am
Newsgroups: comp.lang.c++
From: Jorgen Grahn <grahn+n...@snipabacken.se>
Date: 26 Oct 2009 16:57:53 GMT
Local: Tues, Oct 27 2009 4:27 am
Subject: Re: gcc compiler - debuging

On Sun, 2009-10-25, Maxim Yegorushkin wrote:
> On 25/10/09 14:51, t wrote:
>> Hi
>> How to debuge programc in gcc

> You need to use a debugger, such as gdb. Google for "gdb tutorial".

Well, he doesn't actually need a debugger to debug.

Debugging is to me the activity of fixing bugs in general. You can do
that by reading the code, inserting printf()s, writing unit tests,
running it under strace/valgrind/etc, provoking it in various ways ...
or stepping around in a symbolic debugger.

Personally I never learned to enjoy that last kind of debugging, not
even in C with its usually simpler call chains. (Although naturally I
use gdb for post-mortem debugging of core dumps -- I'm not stupid).

/Jorgen

--
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jacob navia  
View profile  
 More options Oct 27, 5:26 am
Newsgroups: comp.lang.c++
From: jacob navia <ja...@nospam.org>
Date: Mon, 26 Oct 2009 18:56:09 +0100
Local: Tues, Oct 27 2009 5:26 am
Subject: Re: gcc compiler - debuging
Jorgen Grahn a écrit :

You never learned to use a debugger?

If you would have learned, then you would need to do post
mortem debugging less often...

:-)

Maybe you can call it "pre-mortem" :-)


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Maxim Yegorushkin  
View profile  
 More options Oct 27, 10:43 am
Newsgroups: comp.lang.c++
From: Maxim Yegorushkin <maxim.yegorush...@gmail.com>
Date: Mon, 26 Oct 2009 23:13:56 +0000
Local: Tues, Oct 27 2009 10:43 am
Subject: Re: gcc compiler - debuging
On 26/10/09 16:57, Jorgen Grahn wrote:

> On Sun, 2009-10-25, Maxim Yegorushkin wrote:
>> On 25/10/09 14:51, t wrote:
>>> Hi
>>> How to debuge programc in gcc

>> You need to use a debugger, such as gdb. Google for "gdb tutorial".

> Well, he doesn't actually need a debugger to debug.

> Debugging is to me the activity of fixing bugs in general. You can do
> that by reading the code, inserting printf()s, writing unit tests,
> running it under strace/valgrind/etc, provoking it in various ways ...
> or stepping around in a symbolic debugger.

Can not agree more.

> Personally I never learned to enjoy that last kind of debugging, not
> even in C with its usually simpler call chains. (Although naturally I
> use gdb for post-mortem debugging of core dumps -- I'm not stupid).

My first computer was a russian clone of Z80. Most of Z80 programs were
naturally written in assembly language, so the first thing to learn was
to inspect Z80 assembly code with a debugger and a pencil to comment,
injecting printf() statements was science fiction for me at the time ;)

--
Max


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Juha Nieminen  
View profile  
 More options Oct 28, 5:03 am
Newsgroups: comp.lang.c++
From: Juha Nieminen <nos...@thanks.invalid>
Date: Tue, 27 Oct 2009 19:33:05 +0200
Local: Wed, Oct 28 2009 5:03 am
Subject: Re: gcc compiler - debuging

Jorgen Grahn wrote:
> Debugging is to me the activity of fixing bugs in general. You can do
> that by reading the code, inserting printf()s, writing unit tests,
> running it under strace/valgrind/etc, provoking it in various ways ...
> or stepping around in a symbolic debugger.

  You forgot the liberal use of assert(). I cannot even count how many
bugs I have caught very early on development thanks to my liberal use of
assert().

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jorgen Grahn  
View profile  
 More options Oct 29, 2:06 am
Newsgroups: comp.lang.c++
From: Jorgen Grahn <grahn+n...@snipabacken.se>
Date: 28 Oct 2009 14:36:40 GMT
Local: Thurs, Oct 29 2009 2:06 am
Subject: Re: gcc compiler - debuging

On Tue, 2009-10-27, Juha Nieminen wrote:
> Jorgen Grahn wrote:
>> Debugging is to me the activity of fixing bugs in general. You can do
>> that by reading the code, inserting printf()s, writing unit tests,
>> running it under strace/valgrind/etc, provoking it in various ways ...
>> or stepping around in a symbolic debugger.

>   You forgot the liberal use of assert(). I cannot even count how many
> bugs I have caught very early on development thanks to my liberal use of
> assert().

Yeah -- including that one I half-jokingly wanted to have in the
standard library: assume(), hope() or jump_to_conclusion().

(For when you want to assert() something in early prototyping, but
know that you *will* have to handle it seriously later on.)

/Jorgen

--
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Kanze  
View profile  
 More options Oct 29, 2:07 am
Newsgroups: comp.lang.c++
From: James Kanze <james.ka...@gmail.com>
Date: Wed, 28 Oct 2009 07:37:17 -0700 (PDT)
Local: Thurs, Oct 29 2009 2:07 am
Subject: Re: gcc compiler - debuging
On Oct 26, 5:56 pm, jacob navia <ja...@nospam.org> wrote:

More likely, you're confusing cause and effect.  He's never
learned to use a debugger because he hasn't needed it: some of
the ways he has enumerated (code review, detailed unit tests)
are more effective than a debugger in finding an eliminating
bugs.  I know that in situations where good code review and
extensive unit tests are required, almost no one ends up using
the debugger, and in general, I feel that if I need a debugger,
I'm doing something wrong: programming too carelessly, for
example, or not writing detailed enough unit tests.  (Typically,
I'll use one once or twice a year, at the most, and I've done
whole projects without one.)

--
James Kanze


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jorgen Grahn  
View profile  
 More options Oct 29, 3:21 am
Newsgroups: comp.lang.c++
From: Jorgen Grahn <grahn+n...@snipabacken.se>
Date: 28 Oct 2009 15:51:58 GMT
Local: Thurs, Oct 29 2009 3:21 am
Subject: Re: gcc compiler - debuging

I never learned to *enjoy* it, that was what I wrote.  But yes, I tend
to get lost quickly, and I make frequent mistakes, like setting
breakpoints in the wrong place.

I don't think this is embarrassing or unusual.  Most programmers I
know don't use debuggers that way. Maybe it's more common among
Windows programmers -- I have seen one or two good ones use it a lot.

> If you would have learned, then you would need to do post
> mortem debugging less often...

> :-)

I doubt that. I haven't seen people step around in a debugger and
discover crashes they couldn't find more easily by just running the
program (possibly under valgrind or a similar tool).

/Jorgen

--
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Juha Nieminen  
View profile  
 More options Oct 30, 11:29 pm
Newsgroups: comp.lang.c++
From: Juha Nieminen <nos...@thanks.invalid>
Date: Fri, 30 Oct 2009 13:59:57 +0200
Local: Fri, Oct 30 2009 11:29 pm
Subject: Re: gcc compiler - debuging

Jorgen Grahn wrote:
> Yeah -- including that one I half-jokingly wanted to have in the
> standard library: assume(), hope() or jump_to_conclusion().

  Actually an "assume()" function/keyword could be useful in that it
could help the compiler to perform better optimizations. For example,
you could have something like this:

void foo(double d)
{
    assume(d >= 0.0);
    double sd = std::sqrt(d);
    ....

}

  If NDEBUG is not defined, the assume() would work as a regular
assert(). In either case the compiler could use it to optimize the
subsequent std::sqrt call because it can assume that d is always
non-negative.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jorgen Grahn  
View profile  
 More options Nov 5, 5:56 am
Newsgroups: comp.lang.c++
From: Jorgen Grahn <grahn+n...@snipabacken.se>
Date: 4 Nov 2009 18:26:55 GMT
Local: Thurs, Nov 5 2009 5:56 am
Subject: Re: gcc compiler - debuging

Hm, maybe -- but then you have a different definition than I had:

   (For when you want to assert() something in early prototyping, but
   know that you *will* have to handle it seriously later on.)

It's not a hint to the compiler about what will be the usual case,
it's a hint to the reader that the code isn't yet solid.

In your foo(double) example, I would have simply used assert(d >= 0.0).

/Jorgen

--
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google