From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17943 invoked by alias); 22 Oct 2008 11:56:34 -0000 Received: (qmail 17932 invoked by uid 22791); 22 Oct 2008 11:56:33 -0000 X-Spam-Check-By: sourceware.org Received: from ptb-relay02.plus.net (HELO ptb-relay02.plus.net) (212.159.14.146) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 22 Oct 2008 11:55:53 +0000 Received: from [212.32.58.55] (helo=[10.157.52.45]) by ptb-relay02.plus.net with esmtpa (Exim) id 1KscJZ-0002DN-Jk for insight@sourceware.org; Wed, 22 Oct 2008 12:55:49 +0100 Subject: [bug] two unions in a struct crashes insight on inspect. From: Richard To: insight@sourceware.org Content-Type: text/plain Date: Wed, 22 Oct 2008 11:56:00 -0000 Message-Id: <1224676521.5760.13.camel@RMISSENDEN-XP> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-8.el5_2.2) Content-Transfer-Encoding: 7bit X-Plusnet-Relay: 5d9dd008a9cd0109b39bc7c2f125f1ff X-IsSubscribed: yes Mailing-List: contact insight-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sourceware.org X-SW-Source: 2008-q4/txt/msg00004.txt.bz2 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 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 ()