Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: XIAO Wei si A <Wei_Si.a.Xiao@alcatel-lucent.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: RE: GDB step command crashed on non-stop mode
Date: Wed, 22 May 2013 09:00:00 -0000	[thread overview]
Message-ID: <01E5AB929A54FD488EEFBD6595F260AF380B131E@cnshjmbx01> (raw)

Hello,

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:

// test.cc 
#include <string>
using namespace std;
void fun(string &str1, string &str2)
{
    str1 += str2;
}

int main(void)
{
   string str1 = "abc";
   string str2 = "def";
   fun(str1,str2);
   
   return 0;
}


Compile:
g++ -g test.cc -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 <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/test...done.
(gdb) set target-async 1
(gdb) set non-stop on
(gdb) break fun                             
Breakpoint 1 at 0x4007b4: file test.cc, line 5.
(gdb) run 
Starting program: /root/test 

Breakpoint 1, fun (str1=..., str2=...) at test.cc:5
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 test.cc:6
6       }
(gdb)


Does anyone know the root cause?

Thanks in advance,
Weisi


             reply	other threads:[~2013-05-22  9:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22  9:00 XIAO Wei si A [this message]
2013-05-22 14:48 ` Tom Tromey
2013-05-23  5:32   ` XIAO Wei si A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01E5AB929A54FD488EEFBD6595F260AF380B131E@cnshjmbx01 \
    --to=wei_si.a.xiao@alcatel-lucent.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox