From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14340 invoked by alias); 26 Nov 2017 20:41:23 -0000 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 Received: (qmail 14326 invoked by uid 89); 26 Nov 2017 20:41:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 26 Nov 2017 20:41:13 +0000 Received: by mail-wm0-f48.google.com with SMTP id x63so30413093wmf.2 for ; Sun, 26 Nov 2017 12:41:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=b4hDOx7PQMetdR0Tu9N//3Z362PyoWw4HqJ5IXzMsEE=; b=OOnB9808xzk8M7OkOTbRUqC0+SwOnjfOS+OAxzJNsgCyv1PGpkbCklVcZ0ziHgGjb9 EMCm1Yl1iZfWdaDHooQgYAk/7UkUMNg9Ch7YuMQpoi8Gc1uxRs3Zzt4nc1bLX3RKhXDQ HPzCLYp3TN/g/lqU8o5sl4gsGDcgw6e08p5Xhi6VwpGpuJNf8C3j7knZEc3PzOj5zzl0 61dM56LXil55tPTQJHrrN+hYsO7qVVsUsRoT9mcDy9yQghoeKmTMCM4ra0DofqVk2nEe 9rZtMS41HsTxUcChqcgod9xR2wyXOWMkEg+Y6x7Oc5yCjOn3L8SRofEMHdkAnUKIp5u+ c1Lw== X-Gm-Message-State: AJaThX4gXOhJmWVG+2uBt+MqKWwHGgoxcFr/D2unhm9NqT+Tp/WdhGUm 0gYKu9pw1r76xsy8aOpGLoXMQxUnMDcfrKr9cS0= X-Google-Smtp-Source: AGs4zMZzjKi62qplnXG5nkDVCKQ/T1wSSNpjlpKf1X1X04s9zSDGKh/tSKeZyEkZxlQSAr5HiN1mXKBWPYgJUxMAG9s= X-Received: by 10.80.186.15 with SMTP id g15mr34269339edc.165.1511728870952; Sun, 26 Nov 2017 12:41:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.134.45 with HTTP; Sun, 26 Nov 2017 12:40:30 -0800 (PST) In-Reply-To: <83a7z96iln.fsf@gnu.org> References: <83a7z96iln.fsf@gnu.org> From: Dominik Czarnota Date: Sun, 26 Nov 2017 20:41:00 -0000 Message-ID: Subject: Re: Update find command help and search memory docs To: Eli Zaretskii Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2017-11/txt/msg00674.txt.bz2 Changed space after dot into two and fixed a typo `tralinig` -> `trailing`. gdb/ChangeLog: PR gdb/21945 * findcmd.c (_initialize_mem_search), gdb/doc/gdb.texinfo: Update find command description. * doc/gdb.texinfo: Update search memory description and example. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 00451d243d..5b9946a9cf 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -11920,6 +11920,8 @@ giant words (eight bytes) All values are interpreted in the current language. This means, for example, that if the current source language is C/C@t{++} then searching for the string ``hello'' includes the trailing '\0'. +The null terminator can be removed from searching by using casts, +e.g.: @samp{{char[5]}"hello"}. If the value size is not specified, it is taken from the value's type in the current language. @@ -11969,7 +11971,11 @@ you get during debugging: (gdb) find &hello[0], +sizeof(hello), 'h', 'e', 'l', 'l', 'o' 0x8049567 0x804956d -2 patterns found +2 patterns found. +(gdb) find &hello[0], +sizeof(hello), {char[5]}"hello" +0x8049567 +0x804956d +2 patterns found. (gdb) find /b1 &hello[0], +sizeof(hello), 'h', 0x65, 'l' 0x8049567 1 pattern found diff --git a/gdb/findcmd.c b/gdb/findcmd.c index b43fefc06d..ff6088eac1 100644 --- a/gdb/findcmd.c +++ b/gdb/findcmd.c @@ -293,7 +293,9 @@ and if not specified the size is taken from the type of the expression\n\ in the current language.\n\ Note that this means for example that in the case of C-like languages\n\ a search for an untyped 0x42 will search for \"(int) 0x42\"\n\ -which is typically four bytes.\n\ +which is typically four bytes, and a search for a string \"hello\" will\n\ +include the trailing '\\0'. The null terminator can be removed from\n\ +searching by using casts, e.g.: {char[5]}\"hello\".\n\ \n\ The address of the last match is stored as the value of \"$_\".\n\ Convenience variable \"$numfound\" is set to the number of matches."), 2017-11-26 18:43 GMT+01:00 Eli Zaretskii : >> From: Dominik Czarnota >> Date: Sun, 26 Nov 2017 16:44:30 +0100 >> >> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo >> index 00451d243d..5b9946a9cf 100644 >> --- a/gdb/doc/gdb.texinfo >> +++ b/gdb/doc/gdb.texinfo >> @@ -11920,6 +11920,8 @@ giant words (eight bytes) >> All values are interpreted in the current language. >> This means, for example, that if the current source language is C/C@t{++} >> then searching for the string ``hello'' includes the trailing '\0'. >> +The null terminator can be removed from searching by using casts, >> +e.g.: @samp{{char[5]}"hello"}. >> >> If the value size is not specified, it is taken from the >> value's type in the current language. >> @@ -11969,7 +11971,11 @@ you get during debugging: >> (gdb) find &hello[0], +sizeof(hello), 'h', 'e', 'l', 'l', 'o' >> 0x8049567 >> 0x804956d >> -2 patterns found >> +2 patterns found. >> +(gdb) find &hello[0], +sizeof(hello), {char[5]}"hello" >> +0x8049567 >> +0x804956d >> +2 patterns found. >> (gdb) find /b1 &hello[0], +sizeof(hello), 'h', 0x65, 'l' >> 0x8049567 >> 1 pattern found > > This part is OK. > >> diff --git a/gdb/findcmd.c b/gdb/findcmd.c >> index b43fefc06d..ff6088eac1 100644 >> --- a/gdb/findcmd.c >> +++ b/gdb/findcmd.c >> @@ -293,7 +293,9 @@ and if not specified the size is taken from the >> type of the expression\n\ >> in the current language.\n\ >> Note that this means for example that in the case of C-like languages\n\ >> a search for an untyped 0x42 will search for \"(int) 0x42\"\n\ >> -which is typically four bytes.\n\ >> +which is typically four bytes, and a search for a string \"hello\" will\n\ >> +include the tralinig '\\0'. The null terminator can be removed from\n\ > ^^ > Two spaces here, please. > > Thanks.