From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11399 invoked by alias); 15 Apr 2011 14:29:46 -0000 Received: (qmail 11389 invoked by uid 22791); 15 Apr 2011 14:29:44 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from imr4.ericy.com (HELO imr4.ericy.com) (198.24.6.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Apr 2011 14:29:12 +0000 Received: from eusaamw0711.eamcs.ericsson.se ([147.117.20.178]) by imr4.ericy.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id p3FET970024649 for ; Fri, 15 Apr 2011 09:29:11 -0500 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.2.159]) by eusaamw0711.eamcs.ericsson.se ([147.117.20.178]) with mapi; Fri, 15 Apr 2011 10:29:09 -0400 From: Marc Khouzam To: "'gdb@sourceware.org'" Date: Fri, 15 Apr 2011 14:29:00 -0000 Subject: More non-stop single-stepping problems: 'next' fails to set internal breakpoint 0 Message-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00060.txt.bz2 Hi, During a 'next' operation I'm getting=20 (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 2 #include 3 4 void *thread_exec1(void *ptr) 5 { 6 int i; 7 for (i=3D0;i<50;i++) { 8 sleep(2); 9 } 10 } (gdb) l 11 12 int main() 13 { 14 pthread_t thread2; 15 int iret2 =3D pthread_create( &thread2, NULL, thread_exec1, (vo= id*) "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=20 (gdb) [Thread debugging using libthread_db enabled] [New Thread 0xb7fe7b70 (LWP 5379)] =20 Breakpoint 1, thread_exec1 (ptr=3D0x8048610) at multithread.c:8 8 sleep(2); info thr Id Target Id Frame=20 2 Thread 0xb7fe7b70 (LWP 5379) thread_exec1 (ptr=3D0x8048610) at multi= thread.c:8 * 1 Thread 0xb7fe86c0 (LWP 5375) (running) (gdb) thread 2 [Switching to thread 2 (Thread 0xb7fe7b70 (LWP 5379))] #0 thread_exec1 (ptr=3D0x8048610) at multithread.c:8 8 sleep(2); (gdb) n& (gdb) Warning: Cannot insert breakpoint 0. Error accessing memory address 0x80484ef: Input/output error. =20 0x08048408 in sleep@plt () =20 Single stepping until exit from function sleep@plt, which has no line number information. (gdb)