This is the mail archive of the insight@sourceware.org mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[bug] two unions in a struct crashes insight on inspect.


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]