public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Cc: Cristiano De Alti <cristiano_dealti@hotmail.com>
Subject: Re: [PATCH 2/2] gdb: make avr_integer_to_address generate code or data address based on type
Date: Sun, 24 May 2020 17:36:36 +0100	[thread overview]
Message-ID: <25d51e8d-f59a-82e0-ed65-eb173f7b69a4@redhat.com> (raw)
In-Reply-To: <20200524142040.209234-2-simon.marchi@polymtl.ca>

On 5/24/20 3:20 PM, Simon Marchi via Gdb-patches wrote:
> From: Cristiano De Alti <cristiano_dealti@hotmail.com>
> 
> I (Simon Marchi) am re-sending this patch written by Cristiano De Alti:
> 
>     https://sourceware.org/legacy-ml/gdb-patches/2016-03/msg00318.html
> 
> The commit message is new but the code has not changed.
> 
> The AVR architecture is a Harvard one, meaning it has different memory
> spaces for code and data.  In GDB, this is dealt with by having the data
> (SRAM) addresses start at 0x00800000.  When interpreting an integer as
> an address (converting to a CORE_ADDR), we currently always generate a
> data address.  This doesn't work for some cases described below, where
> the integer is meant to represent a code address.
> 
> This patch changes avr_integer_to_address so that it generates the
> correct type of address (code or data) based on the passed type.
> 
> Using the simavr.exp board, I didn't see any regressions when running
> the gdb.base/*.exp tests.  A few tests go from fail to pass, but none
> from pass to fail.  There are a few new fails and unresolved, but it's
> just because some tests manage to make more progress before failing in a
> different way.
> 
> In practice, it fixes disassembling by address, as described in the PR:
> 
>     - (gdb) disassemble 0x12a,0x12b
>     - Dump of assembler code from 0x12a to 0x12b:
>     -    0x0000012a <main+0>: push    r28
>     - End of assembler dump.
> 
>     + (gdb) disassemble 0x12a,0x12b
>     + Dump of assembler code from 0x80012a to 0x80012b:
>     +    0x0080012a:  nop
>     + End of assembler dump.
> 
> And also, setting a breakpoint by address:
> 
>     - (gdb) p &main
>     - $1 = (int (*)(void)) 0x12a <main>
>     - (gdb) b *0x12a
>     - Breakpoint 1 at 0x80012a
> 
>     + (gdb) p &main
>     + $1 = (int (*)(void)) 0x12a <main>
>     + (gdb) b *0x12a
>     + Breakpoint 1 at 0x12a: file test-avr.c, line 3.
>     + Note: automatically using hardware breakpoints for read-only addresses.
> 
> gdb/ChangeLog:
> 
> 	PR gdb/13519
> 	* avr-tdep.c (avr_integer_to_address): Return data or code
> 	address accordingly to the second 'type' argument of the
> 	function.

Thank you for writing the commit log.  LGTM.

Pedro Alves


  reply	other threads:[~2020-05-24 16:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24 14:20 [PATCH 1/2] gdb/testsuite: add simavr.exp board Simon Marchi
2020-05-24 14:20 ` [PATCH 2/2] gdb: make avr_integer_to_address generate code or data address based on type Simon Marchi
2020-05-24 16:36   ` Pedro Alves [this message]
2020-05-24 16:33 ` [PATCH 1/2] gdb/testsuite: add simavr.exp board Pedro Alves
2020-05-25 13:29   ` Simon Marchi
2020-05-25 14:44     ` Pedro Alves
2020-05-25 15:57       ` Simon Marchi

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=25d51e8d-f59a-82e0-ed65-eb173f7b69a4@redhat.com \
    --to=palves@redhat.com \
    --cc=cristiano_dealti@hotmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).