Bug 20345 - call_function_by_hand_dummy: Assertion `tp->thread_fsm == &sm->thread_fsm' failed
Summary: call_function_by_hand_dummy: Assertion `tp->thread_fsm == &sm->thread_fsm' fa...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: 7.11.1
: P2 normal
Target Milestone: 7.12
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-10 12:05 UTC by irotem
Modified: 2016-09-28 21:59 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2016-08-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description irotem 2016-07-10 12:05:26 UTC
The following assertion triggers when I issue the following conditional breakpoint:
----
b open64 if strcmp($a0, "/foo/bar/...") == 0
c
----

----
infcall.c:1136: internal-error: call_function_by_hand_dummy: Assertion `tp->thread_fsm == &sm->thread_fsm' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.
----

I'm using gdb 7.11.1 on my x86-64 machine to remotely debug a multi-threaded program on a linux-uclibc-mipsel machine (uClibc: 0.9.32, kernel: 2.6.37).
I built gdb (and a gdbserver to match) using the same toolchain that was used to build the entire system.
Comment 1 Pedro Alves 2016-08-10 23:09:55 UTC
I tried to reproduce this, but couldn't.  I tried x86_64 host vs x86_64 gdbserver, as I don't have access to a mips uclinux machine, not easy access to mips gnu/linux, for the matter.

Could you try current gdb master and gdb-7.12-branch branches?  7.12 is going to released soon.

If it still triggers, could you try commenting out the assertion, and see what happens?

Also, a run with "set debug infrun 1" + "set debug remote 1" may provide some clue.
Comment 2 Jan Kratochvil 2016-09-28 21:01:04 UTC
Reproducer is at:
gdb crashes on some inferior function call scripts
https://bugzilla.redhat.com/show_bug.cgi?id=1378147
Comment 3 Sourceware Commits 2016-09-28 21:55:37 UTC
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6d61dee599fb314f0561c3bd0dd17ac0cfa05e35

commit 6d61dee599fb314f0561c3bd0dd17ac0cfa05e35
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Sep 28 17:44:57 2016 -0400

    Fix PR 20345 - call_function_by_hand_dummy: Assertion `tp->thread_fsm == &sm->thread_fsm' failed
    
    If you run an infcall from the command line, and immediately after run
    some other command, GDB incorrectly processes the other command before
    the infcall finishes.
    
    The problem is that the fix for PR gdb/20418 (Problems with
    synchronous commands and new-ui, git 3eb7562a983b) moved the
    add_file_handler/delete_file_handler calls out of
    target_terminal_$foo, and missed adjusting the infcall code.
    
    gdb/ChangeLog:
    2016-09-28  Pedro Alves  <palves@redhat.com>
    
    	* infcall.c (run_inferior_call): Remove input from the event
    	loop while running the infcall.
    
    gdb/testsuite/ChangeLog:
    2016-09-28  Pedro Alves  <palves@redhat.com>
    
    	* gdb.base/infcall-input.c: New file.
    	* gdb.base/infcall-input.exp: New file.
Comment 4 Sourceware Commits 2016-09-28 21:57:50 UTC
The gdb-7.12-branch branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=629ad95de4e61ac78f49e1abf4592dbc1fe84d96

commit 629ad95de4e61ac78f49e1abf4592dbc1fe84d96
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Sep 28 17:55:29 2016 -0400

    Fix PR 20345 - call_function_by_hand_dummy: Assertion `tp->thread_fsm == &sm->thread_fsm' failed
    
    If you run an infcall from the command line, and immediately after run
    some other command, GDB incorrectly processes the other command before
    the infcall finishes.
    
    The problem is that the fix for PR gdb/20418 (Problems with
    synchronous commands and new-ui, git 3eb7562a983b) moved the
    add_file_handler/delete_file_handler calls out of
    target_terminal_$foo, and missed adjusting the infcall code.
    
    gdb/ChangeLog:
    2016-09-28  Pedro Alves  <palves@redhat.com>
    
    	* infcall.c (run_inferior_call): Remove input from the event
    	loop while running the infcall.
    
    gdb/testsuite/ChangeLog:
    2016-09-28  Pedro Alves  <palves@redhat.com>
    
    	* gdb.base/infcall-input.c: New file.
    	* gdb.base/infcall-input.exp: New file.
Comment 5 Pedro Alves 2016-09-28 21:59:21 UTC
Fixed now.