From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb: make "start" breakpoint inferior-specific
Date: Fri, 11 Nov 2022 08:53:55 -0500 [thread overview]
Message-ID: <4c7b3e65-08a6-913a-8e0f-8d3812bbd005@efficios.com> (raw)
In-Reply-To: <1c02e882-c19e-483e-e50c-634fbe282988@suse.de>
On 11/11/22 07:37, Tom de Vries wrote:
> On 11/8/22 22:20, Simon Marchi via Gdb-patches wrote:
>> - std::string arg = string_printf ("-qualified %s", main_name ());
>> + std::string arg = string_printf ("-qualified %s if $_inferior == %d", main_name (),
>> + current_inferior ()->num);
>
> Hi,
>
> it seems ada doesn't like the syntax, we get:
> ...
> (gdb) start ^M
> Error in expression, near `1'.^M
> (gdb) UNTESTED: gdb.ada/start.exp: start failed to land inside the right procedure
Huh, sorry, I missed it because it shows up as UNTESTED, which my CI job
doesn't flag as a failure.
Here's a patch that fixes it in a rather naive way. Ideally, we would
implement proper inferior-specific breakpoints, but in any case we want
un-break the tests sooner than that.
From 28f370e7dda4fb2f240ed29493416e78ed47f176 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Fri, 11 Nov 2022 07:58:35 -0500
Subject: [PATCH] gdb: fix start breakpoint expression not working in some
languages
Commit 0be837be9fb4 ("gdb: make "start" breakpoint inferior-specific")
regresses gdb.ada/start.exp:
(gdb) start
Error in expression, near `1'.
(gdb) UNTESTED: gdb.ada/start.exp: start failed to land inside the right procedure
This is because in Ada, the equality operator is =, not ==.
I checked the other languages supported by GDB, these other languages
use = for equality:
- Pascal: tests like gdb.pascal/hello.exp are affected too
- Modula-2: I tried building a Modula-2 hello world using gm2, but it
seems like the generated DWARF doesn't specify the Modula-2 language
in the CUs, it's C++ and C, so the selected language isn't
"modula-2". But if I manually do "set language modula-2" on a dummy
program and then "start", I get the same error.
Other languages all use ==.
So, a short term fix would be to use = or == in the expression, based on
the current language. If this was meant to be permanent, I would
suggest adding something like an "equality_operator" method to
language_defn, that returns the right equality operator for the
language. But the goal is to replace all this with proper
inferior-specific breakpoints, so I hope all this is temporary.
Change-Id: Id4d38e14a80e6bbbb1ad2b2277f974dd55192969
---
gdb/infcmd.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index bf4a68e3557e..6f83949cc7c0 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -428,8 +428,13 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
have proper inferior-specific breakpoint support, in the breakpoint
machinery. We could then avoid inserting a breakpoint in the program
spaces unrelated to this inferior. */
- std::string arg = string_printf ("-qualified %s if $_inferior == %d", main_name (),
- current_inferior ()->num);
+ const char *op
+ = ((current_language->la_language == language_ada
+ || current_language->la_language == language_pascal
+ || current_language->la_language == language_m2) ? "=" : "==");
+ std::string arg = string_printf
+ ("-qualified %s if $_inferior %s %d", main_name (), op,
+ current_inferior ()->num);
tbreak_command (arg.c_str (), 0);
}
base-commit: 70b9d05b26e861524d70ee90dcd28cfd77032ddd
--
2.38.1
next prev parent reply other threads:[~2022-11-11 13:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-04 17:40 [PATCH] " Simon Marchi via Gdb-patches
2022-08-17 17:56 ` Simon Marchi via Gdb-patches
2022-08-31 14:03 ` Bruno Larsen via Gdb-patches
2022-11-04 16:52 ` Simon Marchi via Gdb-patches
2022-11-07 8:14 ` Bruno Larsen via Gdb-patches
2022-11-08 17:24 ` Tom Tromey
2022-09-01 10:42 ` Andrew Burgess via Gdb-patches
2022-11-04 17:24 ` Simon Marchi via Gdb-patches
[not found] ` <8735asb7cj.fsf@redhat.com>
2022-11-09 13:19 ` Simon Marchi via Gdb-patches
2022-11-08 19:43 ` Pedro Alves
2022-11-08 20:14 ` Simon Marchi via Gdb-patches
2022-11-08 21:09 ` Pedro Alves
2022-11-08 21:20 ` [PATCH v2] " Simon Marchi via Gdb-patches
2022-11-10 16:45 ` Pedro Alves
2022-11-10 17:33 ` Simon Marchi via Gdb-patches
2022-11-10 17:36 ` Simon Marchi via Gdb-patches
2022-11-10 17:47 ` Pedro Alves
2022-11-10 17:53 ` Simon Marchi via Gdb-patches
2022-11-11 12:37 ` Tom de Vries via Gdb-patches
2022-11-11 13:53 ` Simon Marchi via Gdb-patches [this message]
2022-11-11 15:21 ` Tom de Vries via Gdb-patches
2022-11-11 19:03 ` Simon Marchi via Gdb-patches
2022-11-12 10:43 ` Tom de Vries via Gdb-patches
2022-11-14 11:29 ` Tom de Vries via Gdb-patches
2022-11-14 13:19 ` Simon Marchi via Gdb-patches
2022-11-14 14:18 ` Tom de Vries via Gdb-patches
2022-11-16 16:22 ` Tom Tromey
2022-11-16 16:26 ` Simon Marchi via Gdb-patches
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=4c7b3e65-08a6-913a-8e0f-8d3812bbd005@efficios.com \
--to=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
--cc=tdevries@suse.de \
/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