From: Andrew Cagney <cagney@gnu.org>
To: Randolph Chung <randolph@tausq.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch/RFA] multiarch INSTRUCTION_NULLIFIED
Date: Sun, 28 Nov 2004 17:26:00 -0000 [thread overview]
Message-ID: <41AA09F8.4020006@gnu.org> (raw)
In-Reply-To: <20041123174937.GL9148@tausq.org>
Randolph Chung wrote:
>> i was trying to figure out that piece of commented out code too and why
>> it was changed. looked through cvs history but didn't find it. I'm not
>> particularly fond of introducing new almost-arch-specific gdbarch
>> methods either, but this does seem to be doing slightly different things
>> than the existing ones. OTOH this is almost a "cosmetic" feature, so one
>> alternative is to drop the INSTRUCTION_NULLIFIED logic completely....
>>
>>Perhaps that isn't such a bad idea if it doesn't confuse GDB too much.
>
>
> i did some more investigations.... turns out this is not a cosmetic
> piece of code at all :)
>
> suppose we have a function that ended with a branch-with-nullify-next
> instruction back to the caller. if you did a "step" on the branch, and
> we don't skip the nullified instruction, we would end up on the
> nullified instruction which actually belongs to the next function.
>
> for example:
>
> Dump of assembler code for function call_with_trampolines:
> 0x0001217c <call_with_trampolines+0>: copy r3,r1
> 0x00012180 <call_with_trampolines+4>: copy sp,r3
> 0x00012184 <call_with_trampolines+8>: stw,ma r1,40(,sp)
> 0x00012188 <call_with_trampolines+12>: ldi -28,r19
> 0x0001218c <call_with_trampolines+16>: fstd fr5,r19(,r3)
> 0x00012190 <call_with_trampolines+20>: ldi -28,r19
> 0x00012194 <call_with_trampolines+24>: fldd r19(,r3),fr22
> 0x00012198 <call_with_trampolines+28>: fcpy,dbl fr22,fr4
> 0x0001219c <call_with_trampolines+32>: ldo 40(r3),sp
> 0x000121a0 <call_with_trampolines+36>: ldw,mb -40(,sp),r3
> 0x000121a4 <call_with_trampolines+40>: bv,n r0(rp)
> End of assembler dump.
> (gdb) disassemble 0x121a8
> Dump of assembler code for function marker_indirect_call:
> 0x000121a8 <marker_indirect_call+0>: copy r3,r1
> 0x000121ac <marker_indirect_call+4>: copy sp,r3
> 0x000121b0 <marker_indirect_call+8>: stw,ma r1,40(,sp)
> 0x000121b4 <marker_indirect_call+12>: ldo 40(r3),sp
> 0x000121b8 <marker_indirect_call+16>: ldw,mb -40(,sp),r3
> 0x000121bc <marker_indirect_call+20>: bv,n r0(rp)
>
> if we are at 0x121a4, and we do a step, it will stop at
> "marker_indirect_call" instead of back at the caller of
> "call_with_trampolines". since the insn at 0x121a8 is not actually
> executed in this call sequence, the correct thing to do is to blindly
> step past the nullified instruction before we make any decision on what
> to do.
>
> here's an updated patch to multiarch INSTRUCTION_NULLIFIED, with updated
> comments and a somewhat cleaner interface.
>
> comments? ok to check in?
I'm still not convinced (it's me and not mark you need to convince here ;-).
Is it possible to create a core file with the PC sitting on the
nullified instruction, and if such a beast is created, how can GDB
correctly handle it - GDB clearly can't single step the core file. If
that problem is solved, this method becomes redundant.
Andrew
next prev parent reply other threads:[~2004-11-28 17:26 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-18 0:02 Randolph Chung
2004-11-18 14:26 ` Andrew Cagney
2004-11-18 16:21 ` Randolph Chung
2004-11-18 16:56 ` Mark Kettenis
2004-11-19 9:25 ` Orjan Friberg
2004-11-23 17:50 ` Randolph Chung
2004-11-23 19:33 ` Mark Kettenis
2004-11-28 17:26 ` Andrew Cagney [this message]
2004-11-28 18:41 ` Randolph Chung
2004-11-28 19:55 ` Andrew Cagney
2004-11-29 3:30 ` Randolph Chung
2004-11-29 15:12 ` Andrew Cagney
2004-11-30 6:56 ` Randolph Chung
2004-11-30 14:51 ` Andrew Cagney
2004-11-30 16:44 ` Randolph Chung
2004-11-30 16:59 ` Andrew Cagney
2004-11-30 17:38 ` Randolph Chung
2004-12-01 21:29 ` Andrew Cagney
2004-12-01 22:33 ` Randolph Chung
2004-12-01 23:32 ` Andrew Cagney
2004-12-02 5:24 ` Randolph Chung
2004-12-02 14:27 ` Daniel Jacobowitz
2004-12-03 18:11 ` Andrew Cagney
2004-12-03 18:15 ` Randolph Chung
2004-12-03 18:57 ` Daniel Jacobowitz
2004-12-03 19:57 ` Randolph Chung
2004-12-03 21:40 ` Randolph Chung
2004-12-03 21:58 ` Andrew Cagney
2004-12-03 22:52 ` Daniel Jacobowitz
2004-12-04 0:00 ` Randolph Chung
2004-12-04 0:55 ` Randolph Chung
2004-12-04 11:27 ` Mark Kettenis
2004-12-01 6:19 ` Randolph Chung
2004-12-01 17:11 ` Daniel Jacobowitz
2004-12-01 17:17 ` Randolph Chung
2004-12-01 17:19 ` Daniel Jacobowitz
2004-12-01 17:25 ` Randolph Chung
2004-12-01 17:28 ` Daniel Jacobowitz
2004-12-01 17:30 ` Randolph Chung
2004-12-01 17:35 ` Randolph Chung
2004-12-01 18:14 ` Randolph Chung
2004-12-01 21:25 ` Andrew Cagney
2004-12-01 13:32 Paul Schlie
2004-12-01 16:25 Randolph Chung
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=41AA09F8.4020006@gnu.org \
--to=cagney@gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=randolph@tausq.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