public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Richard <news@muppet.plus.com>
To: insight@sourceware.org
Subject: [bug] two unions in a struct crashes insight on inspect.
Date: Wed, 22 Oct 2008 11:56:00 -0000	[thread overview]
Message-ID: <1224676521.5760.13.camel@RMISSENDEN-XP> (raw)

I have some quite complicated structs which contain data buffers and the
decoded protocol they contain wrapped in unions for ease of access,
which cause Insight to crash when I try and inspect them.

The following is simplified version of the code which causes the crash,
it does not have a problem if there is only 1 union inside the struct,
only if there are 2 or more. I tried it on both the embedded stm32 I am
developing for and on the PC, same thing. Inspecting the struct in gdb
works ok.

testcase:

#include <stdio.h>
struct buggystruct {
    union {
        char a;
        int  b;
    };
    union {
        char c;
        int  d;
    };
};
int main(void) {
    struct buggystruct bs;
    bs.a=1;
    bs.c=2;
    // put a breakpoint here and try to expand bs in Local Variables
    printf("a=%d b=%d c=%d e=%d \n", bs.a, bs.b, bs.c, bs.d);
}

this works ok:
(gdb) step
a=1 b=-10751 c=2 e=32514 
23      }
(gdb) print bs
$2 = {{a = 1 '\001', b = -10751}, {c = 2 '\002', d = 32514}}

backtrace:
#0  0x00002b574d13850c in Tcl_FindCommand () from /usr/local/lib/libtcl8.4.so
#1  0x00002b574d13d455 in SetCmdNameFromAny () from /usr/local/lib/libtcl8.4.so
#2  0x00002b574d13d0ef in Tcl_GetCommandFromObj () from /usr/local/lib/libtcl8.4.so
#3  0x00002b574d0d5b93 in TclEvalObjvInternal () from /usr/local/lib/libtcl8.4.so
#4  0x00002b574d0d6ae4 in Tcl_EvalEx () from /usr/local/lib/libtcl8.4.so
#5  0x00002b574d0d6f41 in Tcl_Eval () from /usr/local/lib/libtcl8.4.so
#6  0x000000000047128c in gdbtk_two_elem_cmd ()
#7  0x00000000004715bb in gdbtk_fputs ()
#8  0x000000000042bba9 in fputs_unfiltered ()
#9  0x0000000000428dc9 in fputs_maybe_filtered ()
#10 0x00000000004293c6 in vfprintf_maybe_filtered ()
#11 0x00000000004293fb in vfprintf_filtered ()
#12 0x00000000004295ed in fprintf_filtered ()
#13 0x00000000004ed898 in print_exception ()
#14 0x00000000004edadb in print_any_exception ()
#15 0x00000000004edee7 in catch_errors ()
#16 0x000000000041ce86 in captured_main ()
#17 0x00000000004edeb7 in catch_errors ()
#18 0x000000000041cec0 in gdb_main ()
#19 0x000000000041b9b3 in main ()


                 reply	other threads:[~2008-10-22 11:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1224676521.5760.13.camel@RMISSENDEN-XP \
    --to=news@muppet.plus.com \
    --cc=insight@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).