public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [bug] two unions in a struct crashes insight on inspect.
@ 2008-10-22 11:56 Richard
  0 siblings, 0 replies; only message in thread
From: Richard @ 2008-10-22 11:56 UTC (permalink / raw)
  To: insight

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 ()


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-22 11:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-22 11:56 [bug] two unions in a struct crashes insight on inspect Richard

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).