From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3329 invoked by alias); 16 Sep 2011 20:04:17 -0000 Received: (qmail 3319 invoked by uid 22791); 16 Sep 2011 20:04:16 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ey0-f169.google.com (HELO mail-ey0-f169.google.com) (209.85.215.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Sep 2011 20:03:55 +0000 Received: by eye13 with SMTP id 13so1437777eye.0 for ; Fri, 16 Sep 2011 13:03:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.3.155 with SMTP id 27mr13635ebn.50.1316203387516; Fri, 16 Sep 2011 13:03:07 -0700 (PDT) Received: by 10.213.16.201 with HTTP; Fri, 16 Sep 2011 13:03:07 -0700 (PDT) In-Reply-To: References: <4E72241F.5060402@codesourcery.com> <4E735536.1000405@codesourcery.com> Date: Fri, 16 Sep 2011 20:04:00 -0000 Message-ID: Subject: GDB 7.2 gets SIGSEGV when step into a function in a shared library From: Liang Cheng To: gdb@sourceware.org Cc: yao@codesourcery.com 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/msg00058.txt.bz2 Yao/Hui, Built a gdbserver based on gdb 7.3.1, =C2=A0and I get the exactly same erro= r. The gdb that I used is arm-eabi-4.4.3. Here is debug output. Next step is to try gdb trunk. thanks Breakpoint 1, main (argc=3D1, argv=3D0xbed00cb4) at vendor/altestavplayback= .c:284 284 =C2=A0 =C2=A0 =C2=A0 =C2=A0 CheckErr(res); 1: x/i $pc =3D> 0x8d12 : =C2=A0 =C2=A0ldr =C2=A0 =C2=A0 r0, [r7, #52] =C2=A0 = ; 0x34 (gdb) n 286 =C2=A0 =C2=A0 =C2=A0 =C2=A0 z =3D xa_fun_in_lib(10); 1: x/i $pc =3D> 0x8d18 : =C2=A0 =C2=A0mov.w =C2=A0 r0, #10 (gdb) set debug infrun 1 (gdb) show debug infrun Inferior debugging is 1. (gdb) s infrun: clear_proceed_status_thread (Thread 746.746) infrun: proceed (addr=3D0xffffffff, signal=3D144, step=3D1) infrun: resume (step=3D1, signal=3D0), trap_expected=3D0 infrun: wait_for_inferior (treat_exec_as_sigtrap=3D0) infrun: target_wait (-1, status) =3D infrun: =C2=A0 746 [Thread 746.746], infrun: =C2=A0 status->kind =3D stopped, signal =3D SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc =3D 0x8d1c infrun: software single step trap for Thread 746.746 infrun: stepping inside range [0x8d18-0x8d24] infrun: resume (step=3D1, signal=3D0), trap_expected=3D0 infrun: prepare_to_wait infrun: target_wait (-1, status) =3D infrun: =C2=A0 746 [Thread 746.746], infrun: =C2=A0 status->kind =3D stopped, signal =3D SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc =3D 0x8628 infrun: software single step trap for Thread 746.746 infrun: stepped into dynsym resolve code infrun: resume (step=3D1, signal=3D0), trap_expected=3D0 infrun: prepare_to_wait infrun: target_wait (-1, status) =3D infrun: =C2=A0 746 [Thread 746.746], infrun: =C2=A0 status->kind =3D stopped, signal =3D SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc =3D 0x862c infrun: software single step trap for Thread 746.746 infrun: stepped into dynsym resolve code infrun: resume (step=3D1, signal=3D0), trap_expected=3D0 infrun: prepare_to_wait infrun: target_wait (-1, status) =3D infrun: =C2=A0 746 [Thread 746.746], infrun: =C2=A0 status->kind =3D stopped, signal =3D SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc =3D 0x8630 infrun: software single step trap for Thread 746.746 infrun: stepped into dynsym resolve code infrun: resume (step=3D1, signal=3D0), trap_expected=3D0 infrun: prepare_to_wait infrun: target_wait (-1, status) =3D infrun: =C2=A0 746 [Thread 746.746], infrun: =C2=A0 status->kind =3D stopped, signal =3D SIGSEGV infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc =3D 0x8d22 infrun: random signal 11 Program received signal SIGSEGV, Segmentation fault. infrun: stop_stepping 0x00008d22 in main (argc=3D1, argv=3D0xbed00cb4) at vendor/altestavplayback= .c:286 286 =C2=A0 =C2=A0 =C2=A0 =C2=A0 z =3D xa_fun_in_lib(10); 1: x/i $pc =3D> 0x8d22 : =C2=A0 =C2=A0str =C2=A0 =C2=A0 r3, [r7, #44] =C2=A0 = ; 0x2c On Fri, Sep 16, 2011 at 8:55 AM, Yao Qi wrote: > On 09/16/2011 12:39 AM, Liang Cheng wrote: >> 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. =C2=A0Step instruction also caused the same issue. The reason that I >> attach those disassemble dump is to avoid rounds of ask-give. =C2=A0Let = me >> know if disassemble of the piece of code is needed. =C2=A0Any idea of why >> it happens? >> > > This debug session is much clear than last one. =C2=A0Thanks. > >> Breakpoint 1, main (argc=3D1, argv=3D0xbef25ca4) at vendor/altestavplayb= ack.c:284 >> 284 =C2=A0 =C2=A0 =C2=A0 =C2=A0 CheckErr(res); >> 3: x/i $pc >> =3D> 0x8d12 : =C2=A0 =C2=A0ldr =C2=A0 =C2=A0 r0, [r7, #52] =C2= =A0 ; 0x34 >> (gdb) n >> 286 =C2=A0 =C2=A0 =C2=A0 =C2=A0 z =3D xa_fun_in_lib(10); >> 3: x/i $pc >> =3D> 0x8d18 : =C2=A0 =C2=A0mov.w =C2=A0 r0, #10 >> (gdb) s >> > > Before you run `step', turn on some debug output first. =C2=A0Like this `= set > debug infrun 1'. =C2=A0Then, when you run `step', you can see some debug > output, which will show how PC is changed and events inferior gets > during command `step'. > > However, before we go into the details of debug output, could you check > whether GDB cvs trunk works or not. =C2=A0You just have to build gdb for = arm, > and I think GDB cvs trunk should be able to work with your 7.2 gdbserver. > >> Program received signal SIGSEGV, Segmentation fault. >> 0x00008d22 in main (argc=3D1, argv=3D0xbef25ca4) at vendor/altestavplayb= ack.c:286 >> 286 =C2=A0 =C2=A0 =C2=A0 =C2=A0 z =3D xa_fun_in_lib(10); >> 3: x/i $pc >> =3D> 0x8d22 : =C2=A0 =C2=A0str =C2=A0 =C2=A0 r3, [r7, #44] =C2= =A0 ; 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: > > > > -- > Yao (=E9=BD=90=E5=B0=A7) >