This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug threads/22882] New: GDB hangs when calling inferior functions in threaded code


https://sourceware.org/bugzilla/show_bug.cgi?id=22882

            Bug ID: 22882
           Summary: GDB hangs when calling inferior functions in threaded
                    code
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: threads
          Assignee: unassigned at sourceware dot org
          Reporter: stephen.roberts at arm dot com
  Target Milestone: ---

The hang occurs when GDB tries to call inferior functions on two different
threads with scheduler-locking turned on. The first call works fine, with the
call to infrun_async(1) causing the  signal_handler to be marked and the event
to be handled, but then the  event loop resets the "ready" member to zero,
while leaving  infrun_is_async set to 1. As a result, GDB hangs if the user
switches to another thread and calls a  second function because calling
infrun_async(1) a second time has no effect, meaning the inferior call events
are never handled.

On closer inspection, the threads which hang are always ones which did not hit
the breakpoint but were stopped when another thread did hit a breakpoint.
Threads which are stopped at breakpoints are immune to this issue. Loading the
system allows more threads to reach the breakpoint before they are stopped by
gdb. 


This issue affects all versions after 7.12 (including HEAD). For reference,
this is a simplified reproducer for this issue, where get_value is a global
function in a multi-threaded binary:

break after_thread_creation
run
set scheduler-locking on
thread 1
call get_value()
thread 2
call get_value()
# GDB hangs here

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]