From: "Marc Khouzam" <marc.khouzam@ericsson.com>
To: <gdb@sourceware.org>
Subject: Setting breakpoint misbehaving with all threads running in Non-Stop on Linux
Date: Fri, 01 May 2009 19:31:00 -0000 [thread overview]
Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA075CB605@ecamlmw720.eamcs.ericsson.se> (raw)
Hi again,
I'm using HEAD (from yesterday) with Non-Stop locally on Linux.
I notice that when all my threads are running, setting a breakpoint
is misbehaving.
First, should I be able to set a breakpoint when all threads
are running (on Linux)?
Either way though, setting a bp reports an error -with-
a breakpoint id, and then 'info break' shows the breakpoint
as being set. However, the breakpoint does not actually hit.
See below for the session.
Thanks
> gdb -i mi
~"GNU gdb (GDB) 6.8.50.20090430-cvs\n"
~"Copyright (C) 2009 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law. Type \"show
copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-linux-gnu\".\n"
~"For bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
(gdb)
file a.out
&"file a.out\n"
~"Reading symbols from /local/home/lmckhou/testing/a.out..."
~"done.\n"
^done
(gdb)
l 1
&"l 1\n"
~"1\t#include <stdio.h>\n"
~"2\t#include <stdlib.h>\n"
~"3\t#include <pthread.h>\n"
~"4\t#include <unistd.h>\n"
~"5\t\n"
~"6\tvoid *thread_exec(void *ptr)\n"
~"7\t{\n"
~"8\t int j = 0;\n"
~"9\t for (int i=0;i<30;i++) {\n"
~"10\t j++;\n"
^done
(gdb)
l
&"l\n"
~"11\t sleep(1);\n"
~"12\t }\n"
~"13\t}\n"
~"14\t\n"
~"15\tint main()\n"
~"16\t{\n"
~"17\t pthread_t thread2;\n"
~"18\t char *message2 = \"Thread 2\";\n"
~"19\t\n"
~"20\t pthread_create(&thread2, NULL, thread_exec, (void*)
message2);\n"
^done
(gdb)
l
&"l\n"
~"21\t\n"
~"22\t sleep(15);\n"
~"23\t\n"
~"24\t pthread_join(thread2, NULL);\n"
~"25\t\n"
~"26\t printf(\"Thread 2 finished\\n\");\n"
~"27\t\n"
~"28\t return 0;\n"
~"29\t}\n"
^done
(gdb)
set target-async on
&"set target-async on\n"
^done
(gdb)
set pagination off
&"set pagination off\n"
^done
(gdb)
set non-stop on
&"set non-stop on\n"
^done
(gdb)
b 24
&"b 24\n"
~"Breakpoint 1 at 0x80485dc: file MultiThread.cc, line 24.\n"
^done
(gdb)
run&
&"run&\n"
~"Starting program: /local/home/lmckhou/testing/a.out \n"
=thread-group-created,id="23591"
=thread-created,id="1",group-id="23591"
^running
*running,thread-id="1"
=library-loaded,id="/lib/ld-linux.so.2",target-name="/lib/ld-linux.so.2"
,host-name="/lib/ld-linux.so.2",symbols-loaded="0"
(gdb)
=library-loaded,id="/lib/libpthread.so.0",target-name="/lib/libpthread.s
o.0",host-name="/lib/libpthread.so.0",symbols-loaded="0"
=library-loaded,id="/usr/lib/libstdc++.so.6",target-name="/usr/lib/libst
dc++.so.6",host-name="/usr/lib/libstdc++.so.6",symbols-loaded="0"
=library-loaded,id="/lib/libm.so.6",target-name="/lib/libm.so.6",host-na
me="/lib/libm.so.6",symbols-loaded="0"
=library-loaded,id="/lib/libgcc_s.so.1",target-name="/lib/libgcc_s.so.1"
,host-name="/lib/libgcc_s.so.1",symbols-loaded="0"
=library-loaded,id="/lib/libc.so.6",target-name="/lib/libc.so.6",host-na
me="/lib/libc.so.6",symbols-loaded="0"
~"[Thread debugging using libthread_db enabled]\n"
=thread-created,id="2",group-id="23591"
~"[New Thread 0xb7d6cba0 (LWP 23598)]\n"
*running,thread-id="2"
info th
&"info th\n"
~" 2 Thread 0xb7d6cba0 (LWP 23598) (running)\n"
~"* 1 Thread 0xb7d6d6b0 (LWP 23591) (running)\n"
^done
(gdb)
== Here all threads are running ==
b 10
&"b 10\n"
~"Breakpoint 2 at 0x804857a: file MultiThread.cc, line 10.\n"
&"Warning:\n"
&"Cannot insert breakpoint 2.\n"
&"Error accessing memory address 0x804857a: Input/output error.\n"
&"\n"
^error,msg="Warning:\nCannot insert breakpoint 2.\nError accessing
memory address 0x804857a: Input/output error.\n"
== error but bp is shown in 'info break' (see below) ==
(gdb)
b 11
&"b 11\n"
~"Breakpoint 3 at 0x804857e: file MultiThread.cc, line 11.\n"
&"Warning:\n"
&"Cannot insert breakpoint 2.\n"
&"Error accessing memory address 0x804857a: Input/output error.\n"
&"Cannot insert breakpoint 3.\n"
&"Error accessing memory address 0x804857e: Input/output error.\n"
&"\n"
^error,msg="Warning:\nCannot insert breakpoint 2.\nError accessing
memory address 0x804857a: Input/output error.\nCannot insert breakpoint
3.\nError accessing memory address 0x804857e: Input/output error.\n"
== Cummulative error above ==
(gdb)
info b
&"info b\n"
~"Num Type Disp Enb Address What\n"
~"1 breakpoint keep y 0x080485dc in main at
MultiThread.cc:24\n"
~"2 breakpoint keep y 0x0804857a in thread_exec(void*) at
MultiThread.cc:10\n"
~"3 breakpoint keep y 0x0804857e in thread_exec(void*) at
MultiThread.cc:11\n"
^done
== Both 'failed' breakpoints show as installed, but they ==
== don't actually stop the thread. ==
(gdb)
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0
80485dc",func="main",args=[],file="MultiThread.cc",fullname="/local/home
/lmckhou/testing/MultiThread.cc",line="24"},thread-id="1",stopped-thread
s=["1"]
next reply other threads:[~2009-05-01 19:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-01 19:31 Marc Khouzam [this message]
2009-05-02 17:14 ` Pedro Alves
2009-05-03 2:30 ` Marc Khouzam
2009-05-05 17:41 ` Pedro Alves
2009-05-05 19:30 ` 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=6D19CA8D71C89C43A057926FE0D4ADAA075CB605@ecamlmw720.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