* [PATCH] Fix spurious FAILs with examine-backward.exp
@ 2017-03-20 17:14 Andreas Arnez
2017-03-20 17:34 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Arnez @ 2017-03-20 17:14 UTC (permalink / raw)
To: gdb-patches
The test case examine-backward.exp issues the command "x/-s" after the end
of the first string in TestStrings, but without making sure that this
string is preceded by a string terminator. Thus GDB may spuriously print
some random characters from before that string, and then the test fails.
This patch assures that TestStrings is preceded by a string terminator.
gdb/testsuite/ChangeLog:
* gdb.base/examine-backward.c (Barrier): New character array
constant, to ensure that TestStrings is preceded by a string
terminator.
---
gdb/testsuite/gdb.base/examine-backward.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/testsuite/gdb.base/examine-backward.c b/gdb/testsuite/gdb.base/examine-backward.c
index 5e9162a..ab04eff 100644
--- a/gdb/testsuite/gdb.base/examine-backward.c
+++ b/gdb/testsuite/gdb.base/examine-backward.c
@@ -32,6 +32,10 @@ literals. The content of each array is the same as followings:
};
*/
+const char Barrier[] = {
+ 0x00,
+};
+
const char TestStrings[] = {
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
--
2.5.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix spurious FAILs with examine-backward.exp
2017-03-20 17:14 [PATCH] Fix spurious FAILs with examine-backward.exp Andreas Arnez
@ 2017-03-20 17:34 ` Pedro Alves
2017-03-20 17:57 ` Andreas Arnez
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2017-03-20 17:34 UTC (permalink / raw)
To: Andreas Arnez, gdb-patches
On 03/20/2017 05:14 PM, Andreas Arnez wrote:
> The test case examine-backward.exp issues the command "x/-s" after the end
> of the first string in TestStrings, but without making sure that this
> string is preceded by a string terminator. Thus GDB may spuriously print
> some random characters from before that string, and then the test fails.
>
> This patch assures that TestStrings is preceded by a string terminator.
>
Agreed. Looks like I forgot to follow through with:
https://sourceware.org/ml/gdb-patches/2016-08/msg00127.html
>
> +const char Barrier[] = {
> + 0x00,
> +};
> +
OK with a comment. Feel free to steal mine from that url.
> const char TestStrings[] = {
> 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
> 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
>
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix spurious FAILs with examine-backward.exp
2017-03-20 17:34 ` Pedro Alves
@ 2017-03-20 17:57 ` Andreas Arnez
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Arnez @ 2017-03-20 17:57 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Mon, Mar 20 2017, Pedro Alves wrote:
> On 03/20/2017 05:14 PM, Andreas Arnez wrote:
>> The test case examine-backward.exp issues the command "x/-s" after the end
>> of the first string in TestStrings, but without making sure that this
>> string is preceded by a string terminator. Thus GDB may spuriously print
>> some random characters from before that string, and then the test fails.
>>
>> This patch assures that TestStrings is preceded by a string terminator.
>>
>
> Agreed. Looks like I forgot to follow through with:
>
> https://sourceware.org/ml/gdb-patches/2016-08/msg00127.html
Heh, and you even expressed exactly the same thought I had about this:
"It's not strictly correct to assume that the linker places the
objects consecutively, but it's probably safe in practice."
>
>>
>> +const char Barrier[] = {
>> + 0x00,
>> +};
>> +
>
> OK with a comment. Feel free to steal mine from that url.
Sure :-)
Pushed with that change.
Thanks,
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-20 17:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-20 17:14 [PATCH] Fix spurious FAILs with examine-backward.exp Andreas Arnez
2017-03-20 17:34 ` Pedro Alves
2017-03-20 17:57 ` Andreas Arnez
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).