GDB step command crashed on non-stop mode

XIAO Wei si A
Wed May 22 09:00:00 GMT 2013


I am using GDB non-stop mode to debug a multi-thread application. But it always crashed when I use "step" command. I have tried version 7.4/7.5.1/7.6, there result are same. The issue does not exist if we don't use non-stop mode.
I have written a small program to test, easy to reproduce each time. The code as below:

#include <string>
using namespace std;
void fun(string &str1, string &str2)
    str1 += str2;

int main(void)
   string str1 = "abc";
   string str2 = "def";
   return 0;

g++ -g -o test

The procedure for reproduce as below:
vm10-0-0-1:/root-# gdb ./test
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /root/test...done.
(gdb) set target-async 1
(gdb) set non-stop on
(gdb) break fun                             
Breakpoint 1 at 0x4007b4: file, line 5.
(gdb) run 
Starting program: /root/test 

Breakpoint 1, fun (str1=..., str2=...) at
5           str1 += str2;
(gdb) step
6       }
(gdb) step

Program received signal SIGSEGV, Segmentation fault.
fun (str1=<error reading variable: Cannot access memory at address 0xfffffffffffffff8>, str1@entry=<error reading variable: Cannot access memory at address 0x8>, 
    str2=<error reading variable: Cannot access memory at address 0xfffffffffffffff0>, str2@entry=<error reading variable: Cannot access memory at address 0x8>) at
6       }

Does anyone know the root cause?

Thanks in advance,

More information about the Gdb mailing list