public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/32101] New: breakpoint commands not being run (immediately)
@ 2024-08-19 15:38 carlo at alinoe dot com
2024-08-19 15:40 ` [Bug gdb/32101] " carlo at alinoe dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: carlo at alinoe dot com @ 2024-08-19 15:38 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32101
Bug ID: 32101
Summary: breakpoint commands not being run (immediately)
Product: gdb
Version: 15.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: carlo at alinoe dot com
Target Milestone: ---
Created attachment 15675
--> https://sourceware.org/bugzilla/attachment.cgi?id=15675&action=edit
A .gdbinit file
Save the following code snippet to restart_test.cpp and
compile for example with:
g++ -g restart_test.cpp
or
clang++ -g restart_test.cpp
```cpp
// Compile as: g++ -g restart_test.cpp
// Run as: gdb ./a.out
//
// (gdb) b 29
// (gdb) run
// (gdb) rerun
// (gdb) p 0
struct Restart
{
static unsigned long s_count;
void test_break() { }
Restart() {
++s_count;
test_break();
}
};
unsigned long Restart::s_count;
volatile int cnt = 0;
void g()
{
Restart restart_dummy;
++cnt; // Set break point here.
}
int main()
{
g();
}
```
Make sure the attached `dot_gdbinit` is in the current directory as `.gdbinit`
and
run:
gdb ./a.out
Then inside gdb execute:
(gdb) b 29
(gdb) run
(gdb) rerun
Observe that no "RUNNING commands OF BREAKPOINT" was printed even
though we hit the related breakpoint. Now type a command that does "nothing"
for example,
(gdb) p 0
Observe that now "RUNNING commands OF BREAKPOINT" is printed.
Expected behavior: the commands of the breakpoint are executed when it is hit.
OS: Arch linux
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/32101] breakpoint commands not being run (immediately)
2024-08-19 15:38 [Bug gdb/32101] New: breakpoint commands not being run (immediately) carlo at alinoe dot com
@ 2024-08-19 15:40 ` carlo at alinoe dot com
2024-08-19 15:41 ` carlo at alinoe dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: carlo at alinoe dot com @ 2024-08-19 15:40 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32101
--- Comment #1 from Carlo Wood <carlo at alinoe dot com> ---
Created attachment 15676
--> https://sourceware.org/bugzilla/attachment.cgi?id=15676&action=edit
restart_test.cpp
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/32101] breakpoint commands not being run (immediately)
2024-08-19 15:38 [Bug gdb/32101] New: breakpoint commands not being run (immediately) carlo at alinoe dot com
2024-08-19 15:40 ` [Bug gdb/32101] " carlo at alinoe dot com
@ 2024-08-19 15:41 ` carlo at alinoe dot com
2024-12-14 14:10 ` vries at gcc dot gnu.org
2024-12-17 7:58 ` [Bug cli/32101] " vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: carlo at alinoe dot com @ 2024-08-19 15:41 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32101
--- Comment #2 from Carlo Wood <carlo at alinoe dot com> ---
Example of session:
>/usr/bin/gdb ./a.out
GNU gdb (GDB) 15.1
Copyright (C) 2024 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-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...
(gdb) b 29
Breakpoint 1 at 0x115e: file restart_test.cpp, line 29.
(gdb) r
Starting program:
/home/carlo/projects/machine-learning/machine-learning/cairowindow/tests/gradient_descent2/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Breakpoint 1, g () at restart_test.cpp:29
29 ++cnt; // Set break point here.
(gdb) rerun
Temporary breakpoint 2 at 0x555555555194: file restart_test.cpp, line 34.
Temporary breakpoint 3 at 0x5555555551d8: file restart_test.cpp, line 13.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Temporary breakpoint 2, main () at restart_test.cpp:34
34 g();
Temporary breakpoint 3, Restart::test_break (this=0x7fffffffd257) at
restart_test.cpp:13
13 void test_break() { }
(gdb) p 0
$1 = 0
RUNNING commands OF BREAKPOINT
(gdb)
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/32101] breakpoint commands not being run (immediately)
2024-08-19 15:38 [Bug gdb/32101] New: breakpoint commands not being run (immediately) carlo at alinoe dot com
2024-08-19 15:40 ` [Bug gdb/32101] " carlo at alinoe dot com
2024-08-19 15:41 ` carlo at alinoe dot com
@ 2024-12-14 14:10 ` vries at gcc dot gnu.org
2024-12-17 7:58 ` [Bug cli/32101] " vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-14 14:10 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32101
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vries at gcc dot gnu.org
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
I tried out this patch:
...
$ git diff
diff --git a/gdb/ui.c b/gdb/ui.c
index 88a3a14133f..c0edd18067e 100644
--- a/gdb/ui.c
+++ b/gdb/ui.c
@@ -27,6 +27,7 @@
#include "pager.h"
#include "main.h"
#include "top.h"
+#include "command.h"
/* See top.h. */
@@ -247,4 +248,13 @@ Usage: new-ui INTERPRETER TTY\n\
The first argument is the name of the interpreter to run.\n\
The second argument is the terminal the UI runs on."), &cmdlist);
set_cmd_completer (c, interpreter_completer);
+
+
+ add_setshow_boolean_cmd ("ui-async", class_maintenance,
+ (bool *)¤t_ui->async,
+ "", "", "",
+ nullptr,
+ nullptr,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
}
...
and:
...
define main_commands
maint set ui-async on
cont
end
...
and got:
...
$ gdb -q -x gdb.in a.out
Reading symbols from a.out...
(gdb) b 21
Breakpoint 1 at 0x40058b: file test.c, line 21.
(gdb) r
Starting program: /data/vries/gdb/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 1, g () at test.c:21
21 ++cnt; // Set break point here.
(gdb) rerun
Temporary breakpoint 2 at 0x4005a1: file test.c, line 26.
Temporary breakpoint 3 at 0x4005b6: file test.c, line 5.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Temporary breakpoint 2, main () at test.c:26
26 g();
Temporary breakpoint 3, Restart::test_break (this=0x7fffffffdc6f) at test.c:5
5 void test_break() { }
RUNNING commands OF BREAKPOINT
(gdb)
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug cli/32101] breakpoint commands not being run (immediately)
2024-08-19 15:38 [Bug gdb/32101] New: breakpoint commands not being run (immediately) carlo at alinoe dot com
` (2 preceding siblings ...)
2024-12-14 14:10 ` vries at gcc dot gnu.org
@ 2024-12-17 7:58 ` vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-17 7:58 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32101
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|gdb |cli
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-17 7:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-19 15:38 [Bug gdb/32101] New: breakpoint commands not being run (immediately) carlo at alinoe dot com
2024-08-19 15:40 ` [Bug gdb/32101] " carlo at alinoe dot com
2024-08-19 15:41 ` carlo at alinoe dot com
2024-12-14 14:10 ` vries at gcc dot gnu.org
2024-12-17 7:58 ` [Bug cli/32101] " vries at gcc dot gnu.org
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).