Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 562128 - >=sys-devel/gdb-7.10 hangs/spins-on-cpu when debugging any program on Alpha
Summary: >=sys-devel/gdb-7.10 hangs/spins-on-cpu when debugging any program on Alpha
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Alpha Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://sourceware.org/bugzilla/show_...
Whiteboard: tracking upstream
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-03 15:17 UTC by Tobias Klausmann (RETIRED)
Modified: 2018-04-17 16:29 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
alpha-tdep-fix.patch (alpha-tdep-fix.patch,4.33 KB, patch)
2017-12-14 16:06 UTC, Tobias Klausmann (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Klausmann (RETIRED) gentoo-dev 2015-10-03 15:17:52 UTC
Masked 7.10 on alpha for now. From linked upstream bug:

7.9.1 works fine:

$ gdb /bin/ls
GNU gdb (Gentoo 7.9.1 vanilla) 7.9.1
[...]
This GDB was configured as "alpha-unknown-linux-gnu".
Reading symbols from /bin/ls...(no debugging symbols found)...done.
(gdb) run
Starting program: /bin/ls 
4405_alpha-sysctl-uac.patch      gcc-4.6.3.tbz2            secfix.patch
[...]
[Inferior 1 (process 27877) exited normally]
(gdb) quit

7.10:
gdb-7.10 $ gdb/gdb /bin/ls
GNU gdb (7.10-vanilla) 7.10
This GDB was configured as "alpha-unknown-linux-gnu".
Reading symbols from /bin/ls...(no debugging symbols found)...done.
(gdb) run
Starting program: /bin/ls 
[gdb hangs here, eating close to 100% of one CPU. straceing it yields nothing immediately obvious.]

So I bisected this from the tagged gdb-7.xy-release commits, using the example above as a test case. I found was this commit to be the first bad one:

faf09f0119da40d9b408021ad5665a906e00ee59 is the first bad commit
commit faf09f0119da40d9b408021ad5665a906e00ee59
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Mar 4 20:41:16 2015 +0000

    Linux native: Use TRAP_BRKPT/TRAP_HWBPT
    
    This patch adjusts the native Linux target backend to tell the core
    whether a trap was caused by a breakpoint.
    
    It teaches the target to get that information out of the si_code of
    the SIGTRAP siginfo.
    
    Tested on x86-64 Fedora 20, s390 RHEL 7, and PPC64 Fedora 18.  An
    earlier version was tested on ARM Fedora 21.
    
    gdb/ChangeLog:
    2015-03-04  Pedro Alves  <palves@redhat.com>
    
        * linux-nat.c (save_sigtrap): Check for breakpoints before
        checking watchpoints.
        (status_callback) [USE_SIGTRAP_SIGINFO]: Don't check whether a
        breakpoint is inserted if relying on SIGTRAP's siginfo.si_code.
        (check_stopped_by_breakpoint) [USE_SIGTRAP_SIGINFO]: Decide whether
        a breakpoint triggered based on the SIGTRAP's siginfo.si_code.
        (linux_nat_stopped_by_sw_breakpoint)
        (linux_nat_supports_stopped_by_sw_breakpoint)
        (linux_nat_stopped_by_hw_breakpoint)
        (linux_nat_supports_stopped_by_hw_breakpoint): New functions.
        (linux_nat_wait_1): Don't re-increment the PC if relying on
        SIGTRAP's siginfo->si_code.
        (linux_nat_add_target): Install new target methods.
        * linux-thread-db.c (check_event): Don't account for breakpoint PC
        offset if the target already adjusted the PC.
        * nat/linux-ptrace.h (USE_SIGTRAP_SIGINFO): New.
        (GDB_ARCH_TRAP_BRKPT): New.
        (TRAP_HWBKPT): Define if not already defined.

:040000 040000 5623811c697afc352ad61c2090773eacf8b4fbbc 206b4d6974c8a35cbada87c5c9555e8558a798e4 M      gdb


I am unsure how to dig out the actual problem from this, but I can provide access to an Alpha machine if need be.
Comment 1 Matthias Maier gentoo-dev 2017-06-11 17:21:16 UTC
What is the status of gdb-7.12.1 and gdb-8.0?
Comment 2 Tobias Klausmann (RETIRED) gentoo-dev 2017-06-12 17:58:49 UTC
(In reply to Matthias Maier from comment #1)
> What is the status of gdb-7.12.1 and gdb-8.0?

Just checked out and built HEAD (GNU gdb (GDB) 8.0.50.20170612-git), which still hangs on /bin/ls
Comment 3 Tobias Klausmann (RETIRED) gentoo-dev 2017-12-14 16:06:42 UTC
Created attachment 510036 [details, diff]
alpha-tdep-fix.patch

The attached patch makes gdb 8.0.1 work on alpha again. Uros Bizjak will be using it for gcc integration testing on our dev machine, so it should get a good workout over the next few hours. I don't foresee any trouble with it, but will update here once the test is complete.
Comment 4 Matt Turner gentoo-dev 2018-04-17 16:29:45 UTC
Bug was fixed in 8.1. Tobias readded ~alpha in

commit 44b740ed33af8793f81942f26e77639fcc93b69b
Author: Tobias Klausmann <klausman@gentoo.org>
Date:   Wed Apr 11 20:39:01 2018 +0200

    sys-devel/gdb: Remove hard mask on 8.1

Closing.