From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9074 invoked by alias); 23 Aug 2004 20:56:41 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 9048 invoked from network); 23 Aug 2004 20:56:38 -0000 Received: from unknown (HELO smtp805.mail.sc5.yahoo.com) (66.163.168.184) by sourceware.org with SMTP; 23 Aug 2004 20:56:38 -0000 Received: from unknown (HELO dan) (peterschade@sbcglobal.net@68.123.127.203 with login) by smtp805.mail.sc5.yahoo.com with SMTP; 23 Aug 2004 20:56:03 -0000 Message-ID: <009201c48953$9a928140$0401a8c0@dan> From: "Daniel Miller \(IMI\)" To: "Daniel Miller \(IMI\)" , "Daniel Jacobowitz" Cc: Subject: Re: cannot subscript something of type Date: Mon, 23 Aug 2004 20:56:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-SW-Source: 2004-08/txt/msg00296.txt.bz2 Interesting note: The source file is tester.cpp, and I'm compiling with g++. I tried renaming the file to tester.c and compiling with gcc, and the print statements all work fine!!! So apparently this is a c++ issue in gdb. Does that help resolve the problem?? ----- Original Message ----- From: "Daniel Miller (IMI)" To: "Daniel Jacobowitz" Cc: Sent: Monday, August 23, 2004 13:49 Subject: Re: cannot subscript something of type > My system is: > - linux 2.6.7 (running on i386, specifically P4 2.4GHz) > - g++ (GCC) 3.3.3 (SuSE Linux) > - GNU gdb 6.1 > > I compile the following code via > > g++ -Wall -g tester.cpp -o tester > > // source file > #include > > #include "tester.h" > > S_Module Mod[1] ; > > int main(void) > { > Mod[0].powered_up = 1 ; > > printf("powered_up=%u\n", Mod[0].powered_up) ; > return 0; > } > > // header file tester.h > typedef struct S_Module_s > { > unsigned Stat; // module status > unsigned sys_status ; // system errno > unsigned powered_up; > unsigned compat ; > } S_Module; > // } __attribute__ ((__packed__)) S_Module; > > extern S_Module Mod[1]; > //***************************************************** > > After compiling as previously described and loading tester into gdb, I see: > > (gdb) p Mod[0] > cannot subscript something of type `' > (gdb) p (S_Module) Mod[0] > No symbol "S_Module" in current context. > > //***************************************************** > > Note that if I pull the header-file data into the source file, then print > can successfully access the struct. When it's in a separate header, though, > it doesn't work. Of course, my real project has 10 headers and 30-some > source files, so eliminating headers isn't practical. Is there something > else I can do to make this work?? Or should I call this a bug report?? > > Dan Miller > > > //***************************************************** > ----- Original Message ----- > From: "Daniel Jacobowitz" > To: "Daniel Miller (IMI)" > Cc: > Sent: Friday, August 20, 2004 19:11 > Subject: Re: cannot subscript something of type info> > > > > On Fri, Aug 20, 2004 at 06:23:03PM -0700, Daniel Miller (IMI) wrote: > > > I'm trying to debug an application with gdb... I have a struct that is > > > declared thus: > > > > > > typedef struct S_Module_s > > > { > > > unsigned powered_up; > > > ... other data elements ... > > > } __attribute__ ((__packed__)) S_Module; > > > > > > extern S_Module Mod[1]; > > > > > > I tried compiling both with -g and -ggdb, with no change in the > symptoms. > > > > What platform? What version of GDB? > > > > > I don't seem to be able to display any of the contents of Mod[0], at > all.... > > > I get effects such as: > > > > > > (gdb) p Mod[0] > > > cannot subscript something of type `' > > > (gdb) p (S_Module) Mod[0] > > > No symbol "S_Module" in current context. > > > (gdb) p (struct S_Module_s) Mod[0] > > > No struct type named S_Module_s. > > > > > > What do I have to do to get gdb to recognize my variables?? Virtually > every > > > GUI-based debugger out there is a wrapper around gdb, to if it's not > happy, > > > nobody's happy!!! Please help!! > > > > We'll need a standalone test case, or at least a dump of the debugging > > information in the application, to answer this question. > > > > -- > > Daniel Jacobowitz > > > > >