This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Support for x86 on-stack trampolines


> Date: Wed, 4 May 2011 17:17:23 +0200
> From: Jerome Guitton <guitton@adacore.com>
> 
> Mark Kettenis (mark.kettenis@xs4all.nl):
> 
> > Hmm, I think the new name for i386_match_insn is confusing.  Also, it
> > isn't really necessary to change its prototype.  It returns a pointer
> > to the matched pattern, so some trivial pointer arithmetic will give
> > you the index into the array of patterns.
> 
> OK, I don't mind pointer arithmetics. I'm not sure about the name; I haven't
> much imagination for names, I must say. Any suggestion?
> 
> The thing that I would like to make clear is that this new function is
> different from i386_find_insn: it only checks one instruction
> pattern. It is used by both i386_find_insn (which tries to match one
> instruction against any pattern in a set) and by i386_match_insn_block
> (which checks that a given PC points inside a block of instruction
> matching an ordered list of patterns).

Ah, it looks like I created some confusement.  It is i386_find_insn()
as a name that I object to; simply name that funcion i386_match_insn()
and give it the old comment for i386_match_insn(), and I'm happy.
That way you don't have to adjust any of its callers.

i386_match_pattern() is fine as the name for the broken out code that
matches only a single pattern.

> > Is checking the instructions before checking the name the most
> > efficient way of doing this?
> 
> I guess that it depends (big symbol tables vs low connection to
> target).  In any case, to be consistent with the other sniffers, I
> should probably check the name first.

Yeah, it's not clear what's more efficient.  But consistency is always
good.

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]