From: Glynn Clements <glynn@gclements.plus.com>
To: Holger Kiehl <Holger.Kiehl@dwd.de>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Question about core files
Date: Wed, 7 Oct 2009 05:45:33 +0100 [thread overview]
Message-ID: <19148.7405.580856.157196@cerise.gclements.plus.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0910061349060.9660@praktifix.dwd.de>
Holger Kiehl wrote:
> Most the time I compile my application without the -g option due to
> performance reasons.
The -g switch has absolutely no effect upon performance. It simply
causes and additional section to be added to the resulting binary.
When the program is run normally (i.e. not under gdb), that section
won't be mapped. The only downside to -g is that it increases the size
of the file.
However: debug information isn't necessarily much help if you compile
with optimisation enabled, as the resulting machine code will bear
little resemblance to the original source code. Statements will be
re-ordered, many variables will be eliminated, etc.
> Problem is that when it hits some bug and dumps
> core, this is not very useful because there is hardly any information
> in it. Is there some way to get some useful information out of
> the core file. For example one of my program crashed and with gdb
> I see the following:
[snip]
> At least I know that the bug is in my function start_process. But is
> there some way to find out at what line it happened?
It isn't meaningful to talk about a "line" in the source code if you
compile with optimisation enabled.
However, you can tell gdb to disassemble the machine code for a
particular function, and you can print the values contained in
registers or at specific memory locations. Working out what that
information means in terms of the source code is something which needs
to be done manually.
--
Glynn Clements <glynn@gclements.plus.com>
next prev parent reply other threads:[~2009-10-07 4:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-06 14:04 Question about core files Holger Kiehl
2009-10-06 14:41 ` Manish Katiyar
2009-10-07 13:28 ` Holger Kiehl
2009-10-07 13:54 ` Manish Katiyar
2009-10-07 14:21 ` Holger Kiehl
2009-10-07 17:36 ` Manish Katiyar
2009-10-08 18:47 ` Manish Katiyar
2009-10-09 12:09 ` Holger Kiehl
2009-10-09 12:15 ` Manish Katiyar
2009-10-09 12:43 ` Holger Kiehl
2009-10-10 8:35 ` Glynn Clements
2009-10-10 9:08 ` Manish Katiyar
2009-10-10 16:56 ` Holger Kiehl
2009-10-07 4:45 ` Glynn Clements [this message]
2009-10-07 13:43 ` Holger Kiehl
2009-10-08 0:28 ` Glynn Clements
2009-10-09 12:12 ` Holger Kiehl
2009-10-07 4:58 ` vinit dhatrak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19148.7405.580856.157196@cerise.gclements.plus.com \
--to=glynn@gclements.plus.com \
--cc=Holger.Kiehl@dwd.de \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).