From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5880 invoked by alias); 10 Nov 2004 13:14:42 -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 5596 invoked from network); 10 Nov 2004 13:14:15 -0000 Received: from unknown (HELO mr.teledata-networks.com) (194.90.152.129) by sourceware.org with SMTP; 10 Nov 2004 13:14:15 -0000 Received: from mr.teledata-networks.com (localhost.localdomain [127.0.0.1]) by localhost.teledata-networks.com (Postfix) with ESMTP id DAF267C0076 for ; Wed, 10 Nov 2004 15:12:27 +0200 (IST) Received: from tndcmail.Teledata.Local (ADC-FW.ser.netvision.net.il [199.203 .98.2])by mr.teledata-networks.com (Postfix) with ESMTP id D0A057C0070for < gdb@sources.redhat.com>; Wed, 10 Nov 2004 08:12:27 -0500 (EST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-8-i Content-Transfer-Encoding: quoted-printable Subject: Problem with GDB/MI -stack-info-depth in multithreaded MIPS program Date: Wed, 10 Nov 2004 13:42:00 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Yoni Rabinovitch" To: X-imss-version: 2.0 X-imss-result: Passed X-imss-scores: Clean:48.95292 C:20 M:1 S:5 R:5 X-imss-settings: Baseline:1 C:1 M:1 S:1 R:1 (0.0000 0.0000) X-SW-Source: 2004-11/txt/msg00094.txt.bz2 Hi, I am trying to cross-debug a multithreaded program running on an embedded M= IPS 5Kc using=20 Eclipse GDB/MI (running on a Red Hat 9.0 PC) and gdbserver. My environment is as follows: MIPS kernel based on 2.4.18 gdb : 6.2.1, configured with --host=3Di686-pc-linux-gnu --target=3Dmips-ha= rdhat-linux --disable-sim --disable-tcl --enable-threads --enable-shared gdbserver: 6.2.1, configured with --target=3Dmips-linux --enable-threads --= enable-shared gcc : 3.2.3, } binutils : 2.13 } Built using crosstool glibc: 2.2.5 } Now, regular (command line) gdb works OK in my environment, with one small = problem. When I try to examine the stack (e.g. "backtrace"), I get something like the following: (gdb) bt #0 0x2ad00b84 in nanosleep () from /pub/mips-gnu/lib/libc.so.6 #1 0x2ab4e638 in nanosleep () from /pub/mips-gnu/lib/libpthread.so.0 Cannot access memory at address 0x2c This is OK (I guess), apart from the "Cannot access memory at address 0x2c". I have been told that GDB sometimes gets confused by glibc's syscall stubs,= and that I don't need to worry about errors at the end of backtraces. HOWEVER, it seems that this error causes the GDB/MI -stack-info-depth comma= nd to fail, as can=20 be seen from the following trace (from Eclipse): [1,100,086,148,682] (gdb) [1,100,086,148,683] 440-stack-info-depth [1,100,086,148,990] &"Cannot access memory at address 0x2c\n" [1,100,086,148,990] 440^error,msg=3D"Cannot access memory at address 0x2c" [1,100,086,148,991] (gdb) This in turn prevents the Eclipse CDT debug session from working properly. After -stack-info-depth fails, no -stack-list-frames gets issued, and the d= ebugger more or less hangs. So, my question is, is there any way I can get -stack-info-depth to succeed= , rather than just throwing the "Cannot access memory..." error ? After all, gdb "ba= cktrace" works, and provides useful output before the error, so why doesn't -stack-i= nfo-depth ? I have attache3d below more detailed traces of gdb "backtrace" and gdb/mi "= -stack-info-depth" after enabling the gdb debug frame flag. Thanks in advance for any help !! Yoni Output from regular gdb "backtrace" command, after "set debug frame 1" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (gdb) set debug frame 1 (gdb) bt #0 0x2ad00b84 in nanosleep () from /pub/mips-gnu/lib/libc.so.6 { get_prev_frame_1 (this_frame=3D0) -> {level=3D1,type=3DNORMAL_FRAME,unwin= d=3D0x81e46f4,pc=3D0x2ab4e638,id=3D{stack=3D0x30,code=3D0x2ab4e5d8,!special= },func=3D0x2ab4e5d8} // cached #1 0x2ab4e638 in nanosleep () from /pub/mips-gnu/lib/libpthread.so.0 { get_prev_frame_1 (this_frame=3D1) -> {level=3D2,type=3DUNKNOWN_FRAME,unwi= nd=3D,pc=3D,id=3D,func=3D} // cached { frame_register_unwind (frame=3D1,regnum=3D127(pc),...) Cannot access memo= ry at address 0x2c (gdb)=20 Trace of Eclipse GDB/MI -stack-info-depth command, after "set debug frame 1" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D [1,100,086,402,555] 444 set debug frame 1 [1,100,086,402,559] &"set debug frame 1\n" [1,100,086,402,560] 444^done [1,100,086,402,560] (gdb) [1,100,086,405,243] 445-thread-select 4 [1,100,086,405,251] &"{ flush_cached_frames () }\n" [1,100,086,405,373] &"{ create_sentinel_frame (...) -> {level=3D-1,type=3D<= unknown type>,unwind=3D0x822dd9\ 4,pc=3D,id=3D{!stack,!code,!special},func=3D} }\n" [1,100,086,405,374] &"{ get_prev_frame_1 (this_frame=3D-1) -> {level=3D0,ty= pe=3DUNKNOWN_FRAME,unwind=3D,pc=3D,id=3D,func=3D} }\n" [1,100,086,405,375] &"{ frame_register_unwind (frame=3D-1,regnum=3D127(pc),= ...) -> *optimizedp=3D0 *lvalp=3D\ 2 *addrp=3D0x1fc *bufferp=3D[2ad00b84] }\n" [1,100,086,405,376] &"{ frame_pc_unwind (this_frame=3D-1) -> 0x2ad00b84 }\n" [1,100,086,405,376] 445^done,new-thread-id=3D"4",frame=3D{level=3D"0",addr= =3D"0x2ad00b84",func=3D"nanosleep",a\ rgs=3D[],from=3D"/pub/mips-gnu/lib/libc.so.6"} [1,100,086,405,377] (gdb) [1,100,086,405,379] 446-stack-info-depth [1,100,086,405,390] &"{ get_prev_frame_1 (this_frame=3D0) { get_frame_id (f= i=3D0) { frame_register_unwin\ d (frame=3D-1,regnum=3D90(zero),...) -> *optimizedp=3D0 *lvalp=3D2 *addrp= =3D0x168 *bufferp=3D[00000000] }\n" [1,100,086,405,434] &"{ frame_func_unwind (fi=3D-1) -> 0x2ad00b70 }\n" [1,100,086,405,435] &"-> {stack=3D0x0,code=3D0x2ad00b70,!special} }\n" [1,100,086,405,435] &"{ frame_id_p (l=3D{stack=3D0x0,code=3D0x2ad00b70,!spe= cial}) -> 1 }\n" [1,100,086,405,436] &"-> {level=3D1,type=3DUNKNOWN_FRAME,unwind=3D= ,pc=3D,id=3D,func\ =3D} }\n" [1,100,086,405,437] &"{ frame_register_unwind (frame=3D0,regnum=3D127(pc),.= ..) { frame_register_unwind (\ frame=3D-1,regnum=3D121(ra),...) -> *optimizedp=3D0 *lvalp=3D2 *addrp=3D0x1= e4 *bufferp=3D[2ab4aff8] }\n" [1,100,086,405,438] &"-> *optimizedp=3D0 *lvalp=3D2 *addrp=3D0x1e4 *bufferp= =3D[2ab4aff8] }\n" [1,100,086,405,438] &"{ frame_pc_unwind (this_frame=3D0) -> 0x2ab4aff8 }\n" [1,100,086,405,439] &"{ get_prev_frame_1 (this_frame=3D1) { get_frame_id (f= i=3D1) { frame_register_unwin\ d (frame=3D0,regnum=3D119(sp),...) -> *optimizedp=3D0 *lvalp=3D0 *addrp=3D0= x0 *bufferp=3D[00000000] }\n" [1,100,086,405,512] &"{ frame_func_unwind (fi=3D0) -> 0x2ab4adec }\n" [1,100,086,405,512] &"-> {stack=3D0x278,code=3D0x2ab4adec,!special} }\n" [1,100,086,405,513] &"{ frame_id_p (l=3D{stack=3D0x278,code=3D0x2ab4adec,!s= pecial}) -> 1 }\n" [1,100,086,405,514] &"{ frame_id_inner (l=3D{stack=3D0x278,code=3D0x2ab4ade= c,!special},r=3D{stack=3D0x0,code=3D0\ x2ad00b70,!special}) -> 0 }\n" [1,100,086,405,514] &"{ frame_id_eq (l=3D{stack=3D0x278,code=3D0x2ab4adec,!= special},r=3D{stack=3D0x0,code=3D0x2a\ d00b70,!special}) -> 0 }\n" [1,100,086,405,515] &"-> {level=3D2,type=3DUNKNOWN_FRAME,unwind=3D= ,pc=3D,id=3D,func\ =3D} }\n" [1,100,086,405,813] &"{ frame_register_unwind (frame=3D1,regnum=3D127(pc),.= ..) Cannot access memory at a\ ddress 0x240\n" [1,100,086,405,813] 446^error,msg=3D"Cannot access memory at address 0x240" [1,100,086,405,814] (gdb) [1,100,086,405,817] 446-stack-info-depth [1,100,086,405,874] &"{ get_prev_frame_1 (this_frame=3D0) -> {level=3D1,typ= e=3DNORMAL_FRAME,unwind=3D0x81e46\ f4,pc=3D0x2ab4aff8,id=3D{stack=3D0x278,code=3D0x2ab4adec,!special},func=3D0= x2ab4adec} // cached \n" [1,100,086,405,875] &"{ get_prev_frame_1 (this_frame=3D1) -> {level=3D2,typ= e=3DUNKNOWN_FRAME,unwind=3D,pc=3D,id=3D,func=3D} // cached \n" [1,100,086,405,890] &"{ frame_register_unwind (frame=3D1,regnum=3D127(pc),.= ..) Cannot access memory at a\ ddress 0x240\n" [1,100,086,405,891] 446^error,msg=3D"Cannot access memory at address 0x240" [1,100,086,405,891] (gdb) =20