* [RFC] init_breakpoint_sal: Add quotes around part of command in error message
@ 2012-05-15 15:00 Joel Brobecker
2012-05-15 16:24 ` Tom Tromey
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Joel Brobecker @ 2012-05-15 15:00 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker
Hello,
What do you guys think of the following change. If changes:
(gdb) b *rendez_vous'address TASK 2
Garbage TASK 2 at end of command
... into ...
(gdb) b *rendez_vous'address TASK 2
Garbage `TASK 2' at end of command
(actually, the current output is `Garbage 2 at end of command', but
that's a bug that I am planning on fixing).
Surprisingly, this doesn't appear to be tested at all, at the moment,
as a quick grep for `Garbage' in all of gdb/testsuite did not yield
any match. I will submit a testcase with my fix that will test this.
gdb/ChangeLog:
* breakpoint.c (init_breakpoint_sal): Add quotes around part
of command in two error message.
Untested for now, just trying to get feedback. Will definitely test
before checking in, if people like the change.
Thanks,
--
Joel
---
gdb/breakpoint.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9eecdf8..9557430 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8629,7 +8629,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
char *arg = b->cond_string;
loc->cond = parse_exp_1 (&arg, block_for_pc (loc->address), 0);
if (*arg)
- error (_("Garbage %s follows condition"), arg);
+ error (_("Garbage `%s' follows condition"), arg);
}
/* Dynamic printf requires and uses additional arguments on the
@@ -8642,7 +8642,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
error (_("Format string required"));
}
else if (b->extra_string)
- error (_("Garbage %s at end of command"), b->extra_string);
+ error (_("Garbage `%s' at end of command"), b->extra_string);
}
b->display_canonical = display_canonical;
--
1.7.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] init_breakpoint_sal: Add quotes around part of command in error message
2012-05-15 15:00 [RFC] init_breakpoint_sal: Add quotes around part of command in error message Joel Brobecker
@ 2012-05-15 16:24 ` Tom Tromey
2012-05-15 16:28 ` Jan Kratochvil
2012-05-15 16:49 ` [RFC] " Stan Shebs
2 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2012-05-15 16:24 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> (gdb) b *rendez_vous'address TASK 2
Joel> Garbage `TASK 2' at end of command
It makes sense to me.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] init_breakpoint_sal: Add quotes around part of command in error message
2012-05-15 15:00 [RFC] init_breakpoint_sal: Add quotes around part of command in error message Joel Brobecker
2012-05-15 16:24 ` Tom Tromey
@ 2012-05-15 16:28 ` Jan Kratochvil
2012-05-15 16:38 ` Joel Brobecker
2012-05-15 16:49 ` [RFC] " Stan Shebs
2 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2012-05-15 16:28 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Tue, 15 May 2012 16:59:42 +0200, Joel Brobecker wrote:
> - error (_("Garbage %s follows condition"), arg);
> + error (_("Garbage `%s' follows condition"), arg);
When it is already discussed I find `%s' to be deprecated in favor of '%s':
http://www.gnu.org/prep/standards/standards.html#Quote-Characters
Regards,
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] init_breakpoint_sal: Add quotes around part of command in error message
2012-05-15 16:28 ` Jan Kratochvil
@ 2012-05-15 16:38 ` Joel Brobecker
2012-05-15 16:45 ` [commit] " Joel Brobecker
0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2012-05-15 16:38 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
> On Tue, 15 May 2012 16:59:42 +0200, Joel Brobecker wrote:
> > - error (_("Garbage %s follows condition"), arg);
> > + error (_("Garbage `%s' follows condition"), arg);
>
> When it is already discussed I find `%s' to be deprecated in favor of '%s':
> http://www.gnu.org/prep/standards/standards.html#Quote-Characters
Ah, yes, that's right. Thanks for catching that. I will replace
the opening quote by another single-quote and commit.
Thanks Tom and Jan.
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [commit] init_breakpoint_sal: Add quotes around part of command in error message
2012-05-15 16:38 ` Joel Brobecker
@ 2012-05-15 16:45 ` Joel Brobecker
0 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2012-05-15 16:45 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker
For the record, this is the version I ended up checking in.
gdb/ChangeLog:
* breakpoint.c (init_breakpoint_sal): Add quotes around part
of command in two error message.
Tested on x86_64-linux.
---
gdb/ChangeLog | 5 +++++
gdb/breakpoint.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c488a2f..2af1f59 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2012-05-15 Joel Brobecker <brobecker@adacore.com>
+ * breakpoint.c (init_breakpoint_sal): Add quotes around part
+ of command in two error message.
+
+2012-05-15 Joel Brobecker <brobecker@adacore.com>
+
* breakpoint.c (init_breakpoint_sal): Remove trailing spaces.
2012-05-15 Joel Brobecker <brobecker@adacore.com>
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9eecdf8..1a76754 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8629,7 +8629,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
char *arg = b->cond_string;
loc->cond = parse_exp_1 (&arg, block_for_pc (loc->address), 0);
if (*arg)
- error (_("Garbage %s follows condition"), arg);
+ error (_("Garbage '%s' follows condition"), arg);
}
/* Dynamic printf requires and uses additional arguments on the
@@ -8642,7 +8642,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
error (_("Format string required"));
}
else if (b->extra_string)
- error (_("Garbage %s at end of command"), b->extra_string);
+ error (_("Garbage '%s' at end of command"), b->extra_string);
}
b->display_canonical = display_canonical;
--
1.7.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] init_breakpoint_sal: Add quotes around part of command in error message
2012-05-15 15:00 [RFC] init_breakpoint_sal: Add quotes around part of command in error message Joel Brobecker
2012-05-15 16:24 ` Tom Tromey
2012-05-15 16:28 ` Jan Kratochvil
@ 2012-05-15 16:49 ` Stan Shebs
2 siblings, 0 replies; 6+ messages in thread
From: Stan Shebs @ 2012-05-15 16:49 UTC (permalink / raw)
To: gdb-patches
On 5/15/12 7:59 AM, Joel Brobecker wrote:
> gdb/ChangeLog:
>
> * breakpoint.c (init_breakpoint_sal): Add quotes around part
> of command in two error message.
>
> Untested for now, just trying to get feedback. Will definitely test
> before checking in, if people like the change.
>
I think the quoting is a good general principle to follow whenever
reporting any string that originates from user input, or from the
target; cut-n-paste errors and twitchy mice can conspire to generate
thoroughly confusing errors if the strings are not delimited somehow. I
could go with either double quotes or single quotes, but as Jan points
out, the general style seems to prefer a pair of single quotes.
Stan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-15 16:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-15 15:00 [RFC] init_breakpoint_sal: Add quotes around part of command in error message Joel Brobecker
2012-05-15 16:24 ` Tom Tromey
2012-05-15 16:28 ` Jan Kratochvil
2012-05-15 16:38 ` Joel Brobecker
2012-05-15 16:45 ` [commit] " Joel Brobecker
2012-05-15 16:49 ` [RFC] " Stan Shebs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox