Bug 28911 - infcall.c:1287: internal-error: call_function_by_hand_dummy: Assertion `call_thread->thread_fsm () == sm' failed.
Summary: infcall.c:1287: internal-error: call_function_by_hand_dummy: Assertion `call_...
Status: RESOLVED DUPLICATE of bug 28942
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2022-02-21 05:56 UTC by Paul Pluzhnikov
Modified: 2022-10-21 17:58 UTC (History)
2 users (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Paul Pluzhnikov 2022-02-21 05:56:07 UTC
This looks very similar to bug 23191, but has simpler test case.
Reproduced with GDB-10.0, 11.1, and current trunk dc5483c989f29fc9c7934965071ae1bb80cff902.

// --- cut
#include <string>
#include <thread>

#include <unistd.h>

void f2(const std::string& s) {}

void th() {
    while (1) {

void f(const std::string& s) {

int main(int argc,char* argv[]) {
  std::thread t(th);

    for (int i = 0; i < 10; i++) {
    return 0;
// --- cut

g++ -g pthread t2.cc && /build/gdb -q ./a.out

Reading symbols from ./a.out...
(gdb) b f2 if s.c_str() == 0
Breakpoint 1 at 0x22f1: file t2.cc, line 6.
(gdb) run
Starting program: /tmp/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7a4a640 (LWP 928550)]
[Switching to Thread 0x7ffff7a4b740 (LWP 928547)]
Error in testing breakpoint condition:
The program stopped in another thread while making a function call from GDB.
Evaluation of the expression containing the function
(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const) will be abandoned.
When the function is done executing, GDB will silently stop.
[Switching to Thread 0x7ffff7a4a640 (LWP 928550)]

Thread 2 "a.out" hit Breakpoint 1, f2 (s=...) at t2.cc:6
6       void f2(const std::string& s) {}
../../gdb/infcall.c:1287: internal-error: call_function_by_hand_dummy: Assertion `call_thread->thread_fsm () == sm' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x559b9b8a15bc gdb_internal_backtrace_1
0x559b9b8a15bc _Z22gdb_internal_backtracev
0x559b9bbe7bf4 internal_vproblem
0x559b9bbe7e2a _Z15internal_verrorPKciS0_P13__va_list_tag
0x559b9bd01961 _Z14internal_errorPKciS0_z
0x559b9b9f69a2 _Z27call_function_by_hand_dummyP5valueP4typeN3gdb10array_viewIS0_EEPFvPviES6_
0x559b9b99f0eb _ZN4expr23structop_base_operation16evaluate_funcallEP4typeP10expression6nosideRKSt6vectorISt10unique_ptrINS_9operationESt14default_deleteIS8_EESaISB_EE
0x559b9b8b61c5 _ZN4expr20comparison_operationIL10exp_opcode14EXadL_Z13eval_op_equalP4typeP10expression6nosideS1_P5valueS8_EEE8evaluateES3_S5_S6_
0x559b9b99ae2d _ZN10expression8evaluateEP4type6noside
0x559b9b892085 breakpoint_cond_eval
0x559b9b892085 bpstat_check_breakpoint_conditions
0x559b9b892085 _Z18bpstat_stop_statusPK13address_spacemP11thread_infoRK17target_waitstatusP6bpstat
0x559b9ba143e2 handle_signal_stop
0x559b9ba1621a handle_stop_requested
0x559b9ba1621a handle_stop_requested
0x559b9ba1621a handle_inferior_event
0x559b9ba17d1a _Z20fetch_inferior_eventv
0x559b9bd0228d gdb_wait_for_event
0x559b9bd02559 gdb_wait_for_event
0x559b9bd02559 _Z16gdb_do_one_eventv
0x559b9ba598e4 start_event_loop
0x559b9ba598e4 captured_command_loop
0x559b9ba5b3e4 captured_main
0x559b9ba5b3e4 _Z8gdb_mainP18captured_main_args
0x559b9b8017bb main

This is a bug, please report it.  For instructions, see:

Aborted (core dumped)
Comment 1 Tom Tromey 2022-10-21 17:58:28 UTC
This is being fixed in another bug, so picking that one
as canonical.

*** This bug has been marked as a duplicate of bug 28942 ***