From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2836 invoked by alias); 4 May 2011 15:31:03 -0000 Received: (qmail 2824 invoked by uid 22791); 4 May 2011 15:31:01 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 04 May 2011 15:30:47 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id p44FUN73028816; Wed, 4 May 2011 17:30:23 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id p44FUMhC015899; Wed, 4 May 2011 17:30:22 +0200 (CEST) Date: Wed, 04 May 2011 15:31:00 -0000 Message-Id: <201105041530.p44FUMhC015899@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: guitton@adacore.com CC: mark.kettenis@xs4all.nl, gdb-patches@sourceware.org In-reply-to: <20110504151723.GB64873@adacore.com> (message from Jerome Guitton on Wed, 4 May 2011 17:17:23 +0200) Subject: Re: [RFA] Support for x86 on-stack trampolines References: <1304468424-2060-1-git-send-email-guitton@adacore.com> <201105041020.p44AKGt2025840@glazunov.sibelius.xs4all.nl> <20110504151723.GB64873@adacore.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00097.txt.bz2 > Date: Wed, 4 May 2011 17:17:23 +0200 > From: Jerome Guitton > > 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