From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1176 invoked by alias); 2 May 2008 15:33:32 -0000 Received: (qmail 1164 invoked by uid 22791); 2 May 2008 15:33:31 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 02 May 2008 15:33:05 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 28FC7983DA; Fri, 2 May 2008 15:33:04 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 110E0983D6; Fri, 2 May 2008 15:33:04 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JrxFv-00014a-CO; Fri, 02 May 2008 11:33:03 -0400 Date: Fri, 02 May 2008 15:37:00 -0000 From: Daniel Jacobowitz To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [RFA] new command to search memory Message-ID: <20080502153303.GN29202@caradoc.them.org> Mail-Followup-To: Doug Evans , gdb-patches@sourceware.org References: <20080214021915.F3FE51C72F0@localhost> <20080226022335.GB4456@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes 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: 2008-05/txt/msg00091.txt.bz2 On Wed, Apr 09, 2008 at 01:37:26PM -0700, Doug Evans wrote: > If I want to search for 'h', 'e', 'l', 'l', 'o' I won't be able to > use "hello" because that will now include the trailing nul. Often one > will want the trailing nul, but it does make searching for substrings > kinda hard. [For completeness' sake, one could change the definition > of what "hello" means in this context, and if one wants the trailing > nul, one has to explicitly specify it, e.g. "hello\0". It's > C-specific though, and the find command is presumably not supposed to > know the user is thinking in C - that's the whole point. I don't have > an opinion either way.] > > Any suggestions or preferences for whether and how to make searching > for substrings not excessively clumsy? I think that "hello" should be five characters, for this purpose. There's some support for that in C; it's a valid initializer for either char[5] or char[6] (C99 6.7.8#15). Would it help if "hello" reached this point as a TYPE_CODE_STRING but {'a', 'b', '\0'} was TYPE_CODE_ARRAY, so that we could reliably detect strings? I don't think it's a big deal since people will normally leave off the braces for the array here anyway. -- Daniel Jacobowitz CodeSourcery