arm-none-eabi-gdb crashes with segfault:11

Bug #1248981 reported by Kirill Snezhko
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Fix Released
Critical
Terry Guo

Bug Description

I use prebuilt arm-none-eabi-gdb.
GNU gdb (GNU Tools for ARM Embedded Processors) 7.4.1.20130913-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

And openOCD
Open On-Chip Debugger 0.7.0 (2013-11-03-19:15)

On Mac OS X
Darwin skynet-air.local 12.5.0 Darwin Kernel Version 12.5.0: Mon Jul 29 16:33:49 PDT 2013; root:xnu-2050.48.11~1/RELEASE_X86_64 x86_64

I am trying to program stm32f303vct6 on stm32f3discovery.

This command sequence makes gdb to fail.
./arm-none-eabi-gdb
(gdb) tar ext :3333
(gdb) file firmware.elf
(gdb) monitor reset halt
(gdb) load
(gdb) b 2
Fault

But this sequence do not.
./arm-none-eabi-gdb firmware.elf
(gdb) tar ext :3333
(gdb) monitor reset halt
(gdb) load
(gdb) b 2
Succes.

Firmware.elf is attached to this post.

Revision history for this message
Kirill Snezhko (kirill-snezhko) wrote :
Changed in gcc-arm-embedded:
assignee: nobody → Kirill Snezhko (kirill-snezhko)
Revision history for this message
Terry Guo (terry.guo) wrote :

For the failed case, can you please run gdb command "set debug remote 1" right before the "tar ext" command? Then GDB will output more log messages, they might help us to analyze the issue. And if possible, please paste the log message here. Thanks.

Revision history for this message
Kirill Snezhko (kirill-snezhko) wrote :
Download full text (12.1 KiB)

GNU gdb (GNU Tools for ARM Embedded Processors) 7.4.1.20130913-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) set debug remote 1
(gdb) tar ext :3333
Remote debugging using :3333
Sending packet: $qSupported:multiprocess+;qRelocInsn+#2a...Ack
Packet received: PacketSize=3fff;qXfer:memory-map:read+;qXfer:features:read-;QStartNoAckMode+
Packet qSupported (supported-packets) is supported
Sending packet: $QStartNoAckMode#b0...Ack
Packet received: OK
Sending packet: $!#21...Packet received: OK
Sending packet: $Hg0#df...Packet received: OK
Sending packet: $?#3f...Packet received: S00
Sending packet: $Hc-1#09...Packet received: OK
Sending packet: $qC#b4...Packet received: QC0
Sending packet: $qAttached#8f...Packet received: 1
Packet qAttached (query-attached) is supported
Sending packet: $g#67...Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Sending packet: $qXfer:memory-map:read::0,fff#1c...Packet received: l<memory-map>\n<memory type="ram" start="0x0" length="0x8000000"/>\n<memory type="flash" start="0x8000000" length="0x40000">\n<property name="blocksize">0x800</property>\n</memory>\n<memory type="ram" start="0x8040000" length="0xf7fc0000"/>\n</memory-map>\n
Sending packet: $m0,4#fd...Packet received: 00a00020
0x00000000 in ?? ()
Sending packet: $qTStatus#49...Packet received:
(gdb) file firmware.elf
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from /Users/argrento/Development/gcc-arm-none-eabi/bin/firmware.elf...done.
Sending packet: $qTStatus#49...Packet received:
Sending packet: $qTStatus#49...Packet received:
Sending packet: $qTStatus#49...Packet received:
Sending packet: $qTStatus#49...Packet received:
Sending packet: $qSymbol::#5b...Packet received: OK
Packet qSymbol (symbol-lookup) is supported
Sending packet: $qSymbol::#5b...Packet received: OK
Sending packet: $g#67...Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
(gdb) monitor reset halt
Sending packet: $qRcmd,72657365742068616c74#72...Packet received: O
Packet received: O
Packet received: O7461726765742073746174653a2068616c7465640a
target state: halted
Packet received: O7461726765742068616c7465642...

Changed in gcc-arm-embedded:
assignee: Kirill Snezhko (kirill-snezhko) → nobody
status: New → Confirmed
status: Confirmed → New
Terry Guo (terry.guo)
Changed in gcc-arm-embedded:
assignee: nobody → Terry Guo (terry.guo)
Revision history for this message
Niall Parker (stuff-pender) wrote :
Download full text (4.6 KiB)

A very similiar problem here:

GNU gdb (GNU Tools for ARM Embedded Processors) 7.4.1.20130913-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-none-eabi".

Open On-Chip Debugger 0.8.0-dev-00269-g30fb9dd (2013-11-11-13:07)

arm-none-eabi-gdb crossARMexample.elf
GNU gdb (GNU Tools for ARM Embedded Processors) 7.4.1.20130913-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/niall/workspace/crossARMexample/Debug/crossARMexample.elf...done.
(gdb) set debug remote 1
(gdb) tar ext :3333
Remote debugging using :3333
Sending packet: $qSupported:multiprocess+;qRelocInsn+#2a...Ack
Packet received: PacketSize=3fff;qXfer:memory-map:read+;qXfer:features:read+;QStartNoAckMode+
Packet qSupported (supported-packets) is supported
Sending packet: $QStartNoAckMode#b0...Ack
Packet received: OK
Sending packet: $!#21...Packet received: OK
Sending packet: $Hg0#df...Packet received: OK
Sending packet: $qXfer:features:read:target.xml:0,fff#7d...Packet received: l<?xml version="1.0"?>\n<!DOCTYPE target SYSTEM "gdb-target.dtd">\n<target version="1.0">\n<feature name="org.gnu.gdb.arm.m-profile">\n<reg name="r0" bitsize="32" regnum="0" save-restore="yes" type="int" group="general"/>\n<reg name="r1" bitsize="32" regnum="1" save-restore="yes" type="int" group="general"/>\n<reg name="r2" bitsize="32" regnum="2" save-restore="yes" type="int" group="general"/>\n<reg name="r3" bitsize="32" regnum="3" save-restore="yes" type="int" group="general"/>\n<reg name="r4" bitsize="32" regnum="4" save-restore="yes" type="int" group="general"/>\n<reg name="r5" bitsize="32" regnum="5" save-restore="yes" type="int" group="general"/>\n<reg name="r6" bitsize="32" regnum="6" save-restore="yes" type="int" group="general"/>\n<reg name="r7" bitsize="32" regnum="7" save-restore="yes" type="int" group="general"/>\n<reg name="r8" bitsize="32" regnum="8" save-restore="yes" type="int" group="general"/>\n<reg name="r9" bitsize="32" regnum="9" save-restore="yes" type="int" group="general"/>\n<reg name="r10" bitsize="32" regnum="10" save-restore="yes" type="int" group="general"/>\n<reg name="r11" bitsize="32" regnum="11" save-restore="yes" type="int" group="general"/>\n<reg name="r12" bitsize="32" regnum="12" save-restore="yes" type="int" group="general"/>\n<reg name="sp" bitsize="32" regnum="13" save-restore="yes" type="data_ptr" group="general"/>\n<reg name="lr" bitsize="32" regnum="14" save-restore="yes" type="int" group="general...

Read more...

Revision history for this message
Terry Guo (terry.guo) wrote :

Hi Kirill,

Sorry for late response. I now can reproduce the issue on either Mac OS X or Ubuntu. Before further investigation, I suspect this issue related to DWARF debug information saved in elf file. If you are using option -g3 to compile your project, please try with -g2. I will do further investigation and let you known the results.

Revision history for this message
Terry Guo (terry.guo) wrote :

Hi Niall,

Did you install tool chain on an Ubuntu x86_64 machine through APT?

Revision history for this message
Terry Guo (terry.guo) wrote :

Hi Kirill,

I now can confirm that the issue is caused by a known gdb bug which is already fixed in recent gdb. The gdb 7.4.1.20130913 in this release has some problem to decode DWARF debug information generated by -g3 option. For the time being, please recompile your project with -g or -g2 to work around this issue.

Hi Niall,

You might also need to recompile your project with -g or -g2.

Changed in gcc-arm-embedded:
status: New → Fix Committed
importance: Undecided → Critical
milestone: none → 4.7-2014-q1-update
Terry Guo (terry.guo)
Changed in gcc-arm-embedded:
milestone: 4.7-2014-q1-update → none
milestone: none → 4.8-2013-q4-major
Revision history for this message
Niall Parker (stuff-pender) wrote : Re: [Bug 1248981] Re: arm-none-eabi-gdb crashes with segfault:11

On 13-11-13 07:44 PM, Terry Guo wrote:
> Hi Niall,
>
> Did you install tool chain on an Ubuntu x86_64 machine through APT?
>
Yes, via your PPA.

         ... Niall

Revision history for this message
Niall Parker (stuff-pender) wrote :

On 13-11-13 08:41 PM, Terry Guo wrote:
> Hi Kirill,
>
> I now can confirm that the issue is caused by a known gdb bug which is
> already fixed in recent gdb. The gdb 7.4.1.20130913 in this release has
> some problem to decode DWARF debug information generated by -g3 option.
> For the time being, please recompile your project with -g or -g2 to work
> around this issue.
>
> Hi Niall,
>
> You might also need to recompile your project with -g or -g2.
That seems to work, using the eclipse plugin I also played with
toolchain format vs. gdb but in the end just switching to -g was enough
to avoid the segfault on symbol loading.

Thanks !
                     ... Niall
>
> ** Changed in: gcc-arm-embedded
> Status: New => Fix Committed
>
> ** Changed in: gcc-arm-embedded
> Importance: Undecided => Critical
>
> ** Changed in: gcc-arm-embedded
> Milestone: None => 4.7-2014-q1-update
>

Terry Guo (terry.guo)
Changed in gcc-arm-embedded:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.