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) { f2("a"); sleep(5); } } void f(const std::string& s) { f2(s); } int main(int argc,char* argv[]) { std::thread t(th); for (int i = 0; i < 10; i++) { f(std::to_string(i)); } t.join(); 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 ../../gdb/bt-utils.c:122 0x559b9b8a15bc _Z22gdb_internal_backtracev ../../gdb/bt-utils.c:168 0x559b9bbe7bf4 internal_vproblem ../../gdb/utils.c:394 0x559b9bbe7e2a _Z15internal_verrorPKciS0_P13__va_list_tag ../../gdb/utils.c:471 0x559b9bd01961 _Z14internal_errorPKciS0_z ../../gdbsupport/errors.cc:55 0x559b9b9f69a2 _Z27call_function_by_hand_dummyP5valueP4typeN3gdb10array_viewIS0_EEPFvPviES6_ ../../gdb/infcall.c:1287 0x559b9b99f0eb _ZN4expr23structop_base_operation16evaluate_funcallEP4typeP10expression6nosideRKSt6vectorISt10unique_ptrINS_9operationESt14default_deleteIS8_EESaISB_EE ../../gdb/eval.c:966 0x559b9b8b61c5 _ZN4expr20comparison_operationIL10exp_opcode14EXadL_Z13eval_op_equalP4typeP10expression6nosideS1_P5valueS8_EEE8evaluateES3_S5_S6_ ../../gdb/expop.h:1341 0x559b9b99ae2d _ZN10expression8evaluateEP4type6noside ../../gdb/eval.c:101 0x559b9b892085 breakpoint_cond_eval ../../gdb/breakpoint.c:4739 0x559b9b892085 bpstat_check_breakpoint_conditions ../../gdb/breakpoint.c:5303 0x559b9b892085 _Z18bpstat_stop_statusPK13address_spacemP11thread_infoRK17target_waitstatusP6bpstat ../../gdb/breakpoint.c:5475 0x559b9ba143e2 handle_signal_stop ../../gdb/infrun.c:6203 0x559b9ba1621a handle_stop_requested ../../gdb/infrun.c:4473 0x559b9ba1621a handle_stop_requested ../../gdb/infrun.c:4468 0x559b9ba1621a handle_inferior_event ../../gdb/infrun.c:5707 0x559b9ba17d1a _Z20fetch_inferior_eventv ../../gdb/infrun.c:4094 0x559b9bd0228d gdb_wait_for_event ../../gdbsupport/event-loop.cc:700 0x559b9bd02559 gdb_wait_for_event ../../gdbsupport/event-loop.cc:596 0x559b9bd02559 _Z16gdb_do_one_eventv ../../gdbsupport/event-loop.cc:212 0x559b9ba598e4 start_event_loop ../../gdb/main.c:421 0x559b9ba598e4 captured_command_loop ../../gdb/main.c:481 0x559b9ba5b3e4 captured_main ../../gdb/main.c:1348 0x559b9ba5b3e4 _Z8gdb_mainP18captured_main_args ../../gdb/main.c:1363 0x559b9b8017bb main ../../gdb/gdb.c:32 --------------------- This is a bug, please report it. For instructions, see: <https://www.gnu.org/software/gdb/bugs/>. Aborted (core dumped)
This is being fixed in another bug, so picking that one as canonical. *** This bug has been marked as a duplicate of bug 28942 ***