* [commit/obv] Remove trailing space in gdbarch.sh.
@ 2012-12-12 13:56 Joel Brobecker
2012-12-12 15:33 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2012-12-12 13:56 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker
Hello,
I noticed this trailing space when I ran an unmodified gdbarch.sh,
and yet got a difference in gdbarch.h! Fixed in gdbarch.sh.
gdb/ChangeLog:
* gdbarch.sh (software_single_step): Remove trailing space in
comment (gdbarch.h is already correct).
Checked in.
---
gdb/ChangeLog | 5 +++++
gdb/gdbarch.sh | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7b58f00..671aa09 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-12 Joel Brobecker <brobecker@adacore.com>
+
+ * gdbarch.sh (software_single_step): Remove trailing space in
+ comment (gdbarch.h is already correct).
+
2012-12-11 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (dwarf2_get_dwz_file): Set 'dwz_file'.
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 81a70b0..887552e 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -586,7 +586,7 @@ m:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0
# FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the
# target can single step. If not, then implement single step using breakpoints.
#
-# A return value of 1 means that the software_single_step breakpoints
+# A return value of 1 means that the software_single_step breakpoints
# were inserted; 0 means they were not.
F:int:software_single_step:struct frame_info *frame:frame
--
1.7.10.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [commit/obv] Remove trailing space in gdbarch.sh.
2012-12-12 13:56 [commit/obv] Remove trailing space in gdbarch.sh Joel Brobecker
@ 2012-12-12 15:33 ` Pedro Alves
2012-12-12 15:46 ` Tom Tromey
2012-12-13 5:47 ` Joel Brobecker
0 siblings, 2 replies; 5+ messages in thread
From: Pedro Alves @ 2012-12-12 15:33 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On 12/12/2012 01:56 PM, Joel Brobecker wrote:
> Hello,
>
> I noticed this trailing space when I ran an unmodified gdbarch.sh,
> and yet got a difference in gdbarch.h! Fixed in gdbarch.sh.
I don't see such a difference, but the patch is of course fine.
git blame on the corresponding line on gdbarch.h points at:
Author: Joel Brobecker <brobecker@gnat.com>
Date: Wed Oct 26 21:23:54 2011 +0000
Regenerate gdbarch.h
Not sure why, but the version currently checked in as an extraneous
trailing whitespace that showed up as a diff when I reran gdbarch.sh.
gdb/ChangeLog:
* gdbarch.h: Regenerate.
:-)
I'm going to guess that you've been switching between systems, and
on some of those /bin/sh is bash while on others its dash
(most likely the latter is Ubuntu).
Regenerating gdbarch.h from scratch with bash always ends up with
that whitespace stripped for me. If I run 'dash ./gdbarch.sh'
then indeed I see the extra space ending on up gdbarch.h.
"read" trims leading and trailing whitespace by default (on bash at least). We
can make it not do that by setting the IFS variable to empty, like in the
patch below. This should make it so that all shells behave the same
here (tried bash and dash), which I think would be good.
WDYT?
2012-12-12 Pedro Alves <palves@redhat.com>
* gdbarch.sh (do_read): Set IFS to blank.
---
gdb/gdbarch.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 81a70b0..7433378 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -47,7 +47,7 @@ do_read ()
{
comment=""
class=""
- while read line
+ while IFS='' read line
do
if test "${line}" = ""
then
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [commit/obv] Remove trailing space in gdbarch.sh.
2012-12-12 15:33 ` Pedro Alves
@ 2012-12-12 15:46 ` Tom Tromey
2012-12-13 5:47 ` Joel Brobecker
1 sibling, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2012-12-12 15:46 UTC (permalink / raw)
To: Pedro Alves; +Cc: Joel Brobecker, gdb-patches
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> "read" trims leading and trailing whitespace by default (on bash
Pedro> at least). We can make it not do that by setting the IFS
Pedro> variable to empty, like in the patch below. This should make it
Pedro> so that all shells behave the same here (tried bash and dash),
Pedro> which I think would be good.
Pedro> WDYT?
Seems sensible.
I often wish we could replace gdbarch.sh with something nicer.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [commit/obv] Remove trailing space in gdbarch.sh.
2012-12-12 15:33 ` Pedro Alves
2012-12-12 15:46 ` Tom Tromey
@ 2012-12-13 5:47 ` Joel Brobecker
2012-12-13 10:32 ` Pedro Alves
1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2012-12-13 5:47 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
> I don't see such a difference, but the patch is of course fine.
>
> git blame on the corresponding line on gdbarch.h points at:
>
> Author: Joel Brobecker <brobecker@gnat.com>
> Date: Wed Oct 26 21:23:54 2011 +0000
This is my evil twin :-).
> 2012-12-12 Pedro Alves <palves@redhat.com>
>
> * gdbarch.sh (do_read): Set IFS to blank.
Looks good to me.
Good analysis, as /bin/sh is indeed a link to dash on my laptop.
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [commit/obv] Remove trailing space in gdbarch.sh.
2012-12-13 5:47 ` Joel Brobecker
@ 2012-12-13 10:32 ` Pedro Alves
0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2012-12-13 10:32 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On 12/13/2012 05:46 AM, Joel Brobecker wrote:
> This is my evil twin :-).
:-)
>> 2012-12-12 Pedro Alves <palves@redhat.com>
>>
>> * gdbarch.sh (do_read): Set IFS to blank.
>
> Looks good to me.
>
> Good analysis, as /bin/sh is indeed a link to dash on my laptop.
Thanks for confirming. I've applied it now, with an added comment.
2012-12-13 Pedro Alves <palves@redhat.com>
* gdbarch.sh (do_read): Set IFS to blank.
---
gdb/gdbarch.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 887552e..8a56106 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -47,7 +47,10 @@ do_read ()
{
comment=""
class=""
- while read line
+ # On some SH's, 'read' trims leading and trailing whitespace by
+ # default (e.g., bash), while on others (e.g., dash), it doesn't.
+ # Set IFS to empty to disable the trimming everywhere.
+ while IFS='' read line
do
if test "${line}" = ""
then
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-12-13 10:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-12 13:56 [commit/obv] Remove trailing space in gdbarch.sh Joel Brobecker
2012-12-12 15:33 ` Pedro Alves
2012-12-12 15:46 ` Tom Tromey
2012-12-13 5:47 ` Joel Brobecker
2012-12-13 10:32 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox