From: Jerome Guitton <guitton@adacore.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] backtrace in mixed language applications
Date: Fri, 10 Aug 2007 10:03:00 -0000 [thread overview]
Message-ID: <20070810100313.GA29799@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]
Hello,
when doing a backtrace in a mixed-language application, GDB should use the
appriorate language for printing the frames (in particular for printing
arguments). Not the case for now, it prints every frame with the
language of the first one.
This is quite visible in a mixed C/Ada application; for example, in
Ada, pointer to unconstrained strings can be represented with "fat pointers",
which are records containing a pointer to the bound information (P_BOUNDS)
and a pointer to the array of characters (P_ARRAY). Imagine that you have
an ada procedure lang_switch.ada_procedure, which takes an Ada string in
parameter, calling some C code. If you get a backtrace from the C code,
you'll get:
[...]
#0 c_procedure (msg=0xbfffc170 "msg") at foo.c:4
#1 0x08049b91 in lang_switch.ada_procedure (msg={P_ARRAY = 0x805524c,
P_BOUNDS = 0x8055250}) at lang_switch.adb:14
[...]
the msg is bogus in frame #1 is bogus. you should have got:
[...]
#0 c_procedure (msg=0xbfffaa00 "msg") at foo.c:4
#1 0x08049b91 in lang_switch.ada_procedure (msg=0x805524c)
at lang_switch.adb:14
[...]
The patch in attachment should fix that. Tested on x86-linux. The
Ada/C testcase will follow. OK to apply?
Thanks in advance,
Jerome
[-- Attachment #2: stack.c.dif --]
[-- Type: video/dv, Size: 1697 bytes --]
next reply other threads:[~2007-08-10 10:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-10 10:03 Jerome Guitton [this message]
2007-08-15 19:14 ` Joel Brobecker
2007-08-15 19:29 ` Daniel Jacobowitz
2007-09-17 11:28 ` Jerome Guitton
2008-01-09 20:48 ` [RFA] backtrace in mixed language applications (take 2) Joel Brobecker
2008-01-29 18:06 ` Daniel Jacobowitz
2008-02-04 20:56 ` Joel Brobecker
2008-02-04 21:04 ` Joel Brobecker
2008-04-24 2:15 ` Joel Brobecker
2008-05-01 19:48 ` Daniel Jacobowitz
2008-05-07 11:36 ` Joel Brobecker
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=20070810100313.GA29799@adacore.com \
--to=guitton@adacore.com \
--cc=gdb-patches@sources.redhat.com \
/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