Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] backtrace in mixed language applications
@ 2007-08-10 10:03 Jerome Guitton
  2007-08-15 19:14 ` Joel Brobecker
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jerome Guitton @ 2007-08-10 10:03 UTC (permalink / raw)
  To: gdb-patches

[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-05-06 21:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-10 10:03 [RFA] backtrace in mixed language applications Jerome Guitton
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox