From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32252 invoked by alias); 15 Sep 2011 16:39:59 -0000 Received: (qmail 32239 invoked by uid 22791); 15 Sep 2011 16:39:55 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_BL X-Spam-Check-By: sourceware.org Received: from mail-ew0-f42.google.com (HELO mail-ew0-f42.google.com) (209.85.215.42) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Sep 2011 16:39:41 +0000 Received: by ewy2 with SMTP id 2so2116744ewy.15 for ; Thu, 15 Sep 2011 09:39:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.21.25 with SMTP id h25mr1274922ebb.126.1316104779535; Thu, 15 Sep 2011 09:39:39 -0700 (PDT) Received: by 10.213.16.201 with HTTP; Thu, 15 Sep 2011 09:39:39 -0700 (PDT) In-Reply-To: <4E72241F.5060402@codesourcery.com> References: <4E72241F.5060402@codesourcery.com> Date: Thu, 15 Sep 2011 16:39:00 -0000 Message-ID: Subject: Re: GDB 7.2 gets SIGSEGV when step into a function in a shared library From: Liang Cheng To: Yao Qi Cc: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00055.txt.bz2 Sorry for not being clear. Here is the debug session getting SIGSEGV. xa_fun_in_lib is the function defined in shared library, and its symbols has been found by gdb. Step instruction also caused the same issue. The reason that I attach those disassemble dump is to avoid rounds of ask-give. Let me know if disassemble of the piece of code is needed. Any idea of why it happens? thanks Breakpoint 1, main (argc=3D1, argv=3D0xbef25ca4) at vendor/altestavplayback= .c:284 284 CheckErr(res); 3: x/i $pc =3D> 0x8d12 : ldr r0, [r7, #52] ; 0x34 (gdb) n 286 z =3D xa_fun_in_lib(10); 3: x/i $pc =3D> 0x8d18 : mov.w r0, #10 (gdb) s Program received signal SIGSEGV, Segmentation fault. 0x00008d22 in main (argc=3D1, argv=3D0xbef25ca4) at vendor/altestavplayback= .c:286 286 z =3D xa_fun_in_lib(10); 3: x/i $pc =3D> 0x8d22 : str r3, [r7, #44] ; 0x2c (gdb) info address xa_fun_in_lib Symbol "xa_fun_in_lib(int)" is a function at address 0x800036fc. On Thu, Sep 15, 2011 at 11:13 AM, Yao Qi wrote: > On 09/15/2011 12:21 AM, Liang Cheng wrote: >> >> Hi, >> >> The application and library under debug were built for ARM. =C2=A0The >> target is running Android OS, >> and the host is Linux X86 64. =C2=A0As long as we try to step into the >> function xa_fun_in_lib, it would >> cause segmentation fault in gdb. Same thing happened if step the >> instructions. >> >> Here are the experiments I did for this issue, and some notes. >> > > If you are reporting a problem of gdb, please describe the problem as cle= ar > as possible. =C2=A0A clean and simple debug session is helpful for other = people > here to understand what is your problem. =C2=A0Please don't mix the exper= iments > or your work in the problem description. > >> >> So far I am stuck because of no idea why PC gets messed up. Anyone >> else the similar issue >> when trying to debug function in library? =C2=A0And any input to how to >> investigate gdb/gdbserver side >> also is appreciated. =C2=A0(below some other information is dumped). >> > > Due to lack of clear steps you did in gdb, and its output, I have no idea > what the problem is and how do you get to the problem, except for some wi= ld > guess, > >> (gdb) disassemble /m 0x8d14 >> Dump of assembler code for function main: >> .... >> 286 =C2=A0 =C2=A0 =C2=A0 =C2=A0 z =3D xa_fun_in_lib(10); >> =3D> =C2=A00x00008d18<+84>: =C2=A0 =C2=A0mov.w =C2=A0 r0, #10 >> =C2=A0 =C2=A00x00008d1c<+88>: =C2=A0 =C2=A0blx =C2=A0 =C2=A0 0x8628 >> =C2=A0 =C2=A00x00008d20<+92>: =C2=A0 =C2=A0mov =C2=A0 =C2=A0 r3, r0 >> =C2=A0 =C2=A00x00008d22<+94>: =C2=A0 =C2=A0str =C2=A0 =C2=A0 r3, [r7, #4= 4] =C2=A0 ; 0x2c > > How do you get SIGSEGV from here? =C2=A0I guess you typed `step' try to s= tep into > xa_fun_in_lib, but get a SIGSEGV afterwards. > > Last but not least, as Hui suggested, please try GDB 7.3 release or GDB C= VS > trunk. > > -- > Yao (=E9=BD=90=E5=B0=A7) >