Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Omair Javaid <omair.javaid@linaro.org>
Cc: gdb-patches@sourceware.org, Patch Tracking <patches@linaro.org>
Subject: Re: [PATCH] testsuite/gdb.dwarf2: Fix for dw2-dos-drive failure on ARM
Date: Thu, 16 Jan 2014 10:25:00 -0000	[thread overview]
Message-ID: <52D7B39E.7080608@redhat.com> (raw)
In-Reply-To: <529CF8B3.60906@linaro.org>

On 12/02/2013 09:16 PM, Omair Javaid wrote:
> On 10/01/2013 08:34 PM, Pedro Alves wrote:
>> So, in the end, it'd be fine with me to just go in the
>> direction of your original patch then.  But I think it deserves
>> a comment:
>>
>>  pc_start:
>>         /* Enough space to fit one instruction.  */
>> -       .byte   0
>> +       .4byte  0
>>  pc_end:
>>
>> Could you resend your patch, with that change, a fixed commit
>> log description and fixed ChangeLog?

> Sorry about responding late to this. I have attached the patch along with commit message and a ChangeLog.
> 
> Commit Log Message: 
> 
> 	Avoid test failure due to error thrown from skip prologue code by
> 	an illegal memory access in case of single byte text section

Period at end of sentences.  That log if very incomplete though.
See below for what I suggest.  (Note I tweaked the subject too)

The best/easiest is to write that in the git commit log in your
local tree, and send out the commit exactly as you propose
to push.

> gdb/testsuite/ChangeLog:
> 
> 2013-12-02  Omair Javaid  <Omair.Javaid@linaro.org>
> 
> 	* gdb.dwarf2/dw2-dos-drive.S: Changed text section size to 4 bytes

Period at end of sentence.

> 
> ---
>  gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
> index 682ba4e..f226912 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
> @@ -15,7 +15,7 @@
>  
>  	.text
>  pc_start:
> -	.byte	0
> +	.4byte	0

Still misses comment.  The version below adds one similar to
what I suggested before.

If this looks good to you, I'll push it.

Thanks.

-- >8 --
From: Omair Javaid <omair.javaid@linaro.org>
Subject: Fix testsuite/gdb.dwarf2/dw2-dos-drive.exp on ARM.

This test currently fails on ARM:

  (gdb) PASS: gdb.dwarf2/dw2-dos-drive.exp: set breakpoint pending off
  break 'z:file.c':func
  Cannot access memory at address 0x0

The error is GDB trying to read the prologue at the breakpoint's
address, and failing:

  38 throw_error() exceptions.c:444 0x0016728c
  37 memory_error() corefile.c:204 0x001d1fcc
  36 read_memory() corefile.c:223 0x001d201a
  35 read_memory_unsigned_integer() corefile.c:312 0x001d2166
  34 arm_skip_prologue() arm-tdep.c:1452 0x00054270

  static CORE_ADDR
  arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
  {
  ...
    for (skip_pc = pc; skip_pc < limit_pc; skip_pc += 4)
      {
        inst = read_memory_unsigned_integer (skip_pc, 4, byte_order_for_code);


The test doesn't execute the compiled object's code, so GDB will try
to read memory from the binary's sections.  Instructions on ARM are
4-byte wide, and thus ARM's prologue scanner reads in 4-byte chunks.
As the section 'func' is put at is only 1 byte long, and no other
section is allocated contiguously:

  ...
  Sections:
  Idx Name          Size      VMA       LMA       File off  Algn
    0 .text         00000001  00000000  00000000  00000034  2**0
                    CONTENTS, ALLOC, LOAD, READONLY, CODE
  ...

... the exec target fails the read the 4 bytes.

Fix this by increasing the function's size.

gdb/testsuite/ChangeLog:
2014-01-16  Omair Javaid  <Omair.Javaid@linaro.org>

	* gdb.dwarf2/dw2-dos-drive.S: Increase text section size to 4
	bytes.
---
 gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
index 6e9d360..84006f7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
@@ -15,7 +15,8 @@
 
 	.text
 pc_start:
-	.byte	0
+        /* Enough space to fit at least one instruction.  */
+	.4byte	0
 pc_end:
 
 	.section	.debug_info
-- 
1.7.11.7



  parent reply	other threads:[~2014-01-16 10:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANW4E-3h4UODqrXEjP2Z8AmZa+eYtXnTY337EosXTSE6016uGQ@mail.gmail.com>
2013-07-15 10:27 ` Omair Javaid
2013-07-30 15:38   ` Pedro Alves
2013-09-19 15:23     ` Omair Javaid
2013-09-19 15:53       ` Pedro Alves
2013-10-01  8:32         ` Omair Javaid
2013-10-01 15:34           ` Pedro Alves
2013-12-02 21:17             ` Omair Javaid
2014-01-15 18:39               ` Omair Javaid
2014-01-16 10:25               ` Pedro Alves [this message]
2014-01-16 10:35                 ` Omair Javaid
2014-01-16 10:58                   ` Pedro Alves

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=52D7B39E.7080608@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=omair.javaid@linaro.org \
    --cc=patches@linaro.org \
    /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