From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] ia64: Fix breakpoints memory shadow
Date: Fri, 31 Oct 2008 00:03:00 -0000 [thread overview]
Message-ID: <20081030144841.GA26606@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20081029210242.GA3635@adacore.com>
Hi Joel,
On Wed, 29 Oct 2008 22:02:42 +0100, Joel Brobecker wrote:
> I understand the overall idea, but I don't understand the logic behind
> saving BUNDLE_LEN - 2 bytes (14 bytes, then) of the bundle at bundle
> address + slotnum. It looks like this introduces extra complexity.
>
> Instead, would it be possible to save the entire bundle, when
> inserting the breakpoint? When comes time to remove it, we would
> only need to read the whole bundle, extract the original insn from
> our saved bundle, and then push it back into the target bundle.
I agree your proposal would be better but we have to comply with the current
`struct bp_target_info' layout which is being intepreted outside of
ia64-tdep.c - in breakpoint_restore_shadows.
If we would like to store the whole bundle to SHADOW_CONTENTS we would have to
store already the base address (`address & ~0x0f') into PLACED_ADDRESS. In
such case there is no other place where to store SLOTNUM (`adress & 0x0f',
value in the range <0..2>). We need to know SLOTNUM in
ia64_memory_remove_breakpoint.
ia64 16-byte bundle layout:
| 5 bits | slot 0 with 41 bits | slot 1 with 41 bits | slot 2 with 41 bits |
(A) The current way of the patch:
original PC placed_address placed_size required covered
== bp_tgt->shadow_len required \subset covered
0xABCDE0 0xABCDE0 0xE <0x0...0x5> <0x0..0xD>
0xABCDE1 0xABCDE1 0xE <0x5...0xA> <0x1..0xE>
0xABCDE2 0xABCDE2 0xE <0xA...0xF> <0x2..0xF>
(B) Another way would be (converting `original PC' -> `placed_address' in
ia64_breakpoint_from_pc):
original PC placed_address placed_size required covered
== bp_tgt->shadow_len
0xABCDE0 0xABCDE0 0x6 <0x0...0x5> <0x0..0x5>
0xABCDE1 0xABCDE5 0x6 <0x5...0xA> <0x5..0xA>
0xABCDE2 0xABCDEA 0x6 <0xA...0xF> <0xA..0xF>
`objdump -d' and some other tools show a bit unjustified offsets:
original PC byte where starts the instruction objdump offset
0xABCDE0 0xABCDE0 0xABCDE0
0xABCDE1 0xABCDE5 0xABCDE6
0xABCDE2 0xABCDEA 0xABCDEC
I can freely change the current (A) way for (B) but I found the code easier
this way. (B) would be more minimal/effective but sure it does not matter.
> > +# We need to start the inferior to place the breakpoints in the memory at all.
> > +if { [gdb_start_cmd] < 0 } {
> > + untested start
> > + return -1
> > +}
> > +gdb_test "" "main \\(\\) at .*" "start"
>
> Why not use runto_main here?
I will change it in the final patch together with a note in gdb.base/start.exp
that it is there to test gdb_start_cmd, not to start a program.
Thanks,
Jan
next prev parent reply other threads:[~2008-10-30 22:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-28 17:52 Jan Kratochvil
2008-10-30 1:51 ` Joel Brobecker
2008-10-31 0:03 ` Jan Kratochvil [this message]
2008-11-01 18:54 ` Joel Brobecker
2008-11-11 20:20 ` Jan Kratochvil
2008-11-13 14:27 ` Joel Brobecker
2008-11-21 1:11 ` Jan Kratochvil
2008-11-22 18:35 ` Joel Brobecker
2008-11-22 19:08 ` Eli Zaretskii
2008-11-24 2:25 ` Joel Brobecker
2008-11-24 7:09 ` Jan Kratochvil
2008-11-25 17:49 ` Joel Brobecker
2008-11-27 0:41 ` Jan Kratochvil
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=20081030144841.GA26606@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.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