public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Marc Khouzam <marc.khouzam@ericsson.com>
To: "'gdb@sourceware.org'" <gdb@sourceware.org>
Subject: More non-stop single-stepping problems: 'next' fails to set internal breakpoint 0
Date: Fri, 15 Apr 2011 14:29:00 -0000	[thread overview]
Message-ID: <F7CE05678329534C957159168FA70DEC577DAA1F92@EUSAACMS0703.eamcs.ericsson.se> (raw)

Hi,

During a 'next' operation I'm getting 

(gdb) Warning:
Cannot insert breakpoint 0.
Error accessing memory address 0x80484ef: Input/output error.

I'm on linux 32bit but the problem was also reported to me on 64bit.

I reproduced it with a simple program below.
The conditions that I needed to reproduce are:
1- multi-thread (2 or more)
2- non-stop
3- all but one thread are running
4- the stopped thread tries to 'next' over a method

I debugged GDB and I think that ptrace gives a failure
when trying to read memory to see if we can set
the breakpoint, inside inf_ptrace_xfer_partial().

I see the bug with 7.1, 7.2 and 7.3 but I don't see it
using GDB 7.0.

Should I open a PR?  At first glance, this seems pretty
serious.  It would indicate that we cannot step-over
a method in multi-threaded non-stop unless we have
a second thread stopped.

Chris Hall also reported some stepping problems in
non-stop in:
http://sourceware.org/ml/gdb/2011-03/msg00049.html
which may or may not be related.

Thanks

Marc


> gdb.7.3 a.out
GNU gdb (GDB) 7.2.90.20110414-cvs
[snip]
Reading symbols from /home/lmckhou/testing/a.out...done.
(gdb) set target-async on
(gdb) set pagination off
(gdb) set non-stop on
(gdb) l 1
1       #include <pthread.h>
2       #include <unistd.h>
3
4       void *thread_exec1(void *ptr)
5       {
6           int i;
7           for (i=0;i<50;i++) {
8               sleep(2);
9           }
10      }
(gdb) l
11
12      int main()
13      {
14          pthread_t thread2;
15          int iret2 = pthread_create( &thread2, NULL, thread_exec1, (void*) "Thread 2");
16
17          pthread_join(thread2, NULL);
18
19          return 0;
20      }
(gdb) b 8
Breakpoint 1 at 0x80484e3: file multithread.c, line 8.
(gdb) r&
Starting program: /home/lmckhou/testing/a.out 
(gdb) [Thread debugging using libthread_db enabled]
[New Thread 0xb7fe7b70 (LWP 5379)]
 
Breakpoint 1, thread_exec1 (ptr=0x8048610) at multithread.c:8
8               sleep(2);
info thr
  Id   Target Id         Frame 
  2    Thread 0xb7fe7b70 (LWP 5379) thread_exec1 (ptr=0x8048610) at multithread.c:8
* 1    Thread 0xb7fe86c0 (LWP 5375) (running)
(gdb) thread 2
[Switching to thread 2 (Thread 0xb7fe7b70 (LWP 5379))]
#0  thread_exec1 (ptr=0x8048610) at multithread.c:8
8               sleep(2);
(gdb) n&
(gdb) Warning:
Cannot insert breakpoint 0.
Error accessing memory address 0x80484ef: Input/output error.
 
0x08048408 in sleep@plt ()
 
Single stepping until exit from function sleep@plt,
which has no line number information.
(gdb)

             reply	other threads:[~2011-04-15 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 14:29 Marc Khouzam [this message]
     [not found] <F7CE05678329534C957159168FA70DEC577DA3A2CA@EUSAACMS0703.eamcs.ericsson.se>
2011-04-17 13:14 ` Marc Khouzam

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=F7CE05678329534C957159168FA70DEC577DAA1F92@EUSAACMS0703.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).