From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30267 invoked by alias); 16 Apr 2014 22:46:17 -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 30257 invoked by uid 89); 16 Apr 2014 22:46:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Apr 2014 22:46:16 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3GMkDMM020551 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Apr 2014 18:46:13 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3GMUh2u018340 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 16 Apr 2014 18:30:44 -0400 Message-ID: <534F0493.9040404@redhat.com> Date: Wed, 16 Apr 2014 22:46:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: David Taylor , "gdb-patches@sourceware.org" Subject: Re: RFA/remote: compare-sections References: <24262.1395849610@usendtaylorx2l> <29572.1396557529@usendtaylorx2l> <18733.1397666636@usendtaylorx2l> In-Reply-To: <18733.1397666636@usendtaylorx2l> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00336.txt.bz2 On 04/16/2014 09:43 AM, David Taylor wrote: > Final ping. Hi, David, I am really sorry that patch reviewing is going so slowly right now. It appears the few active maintainers we have are (extremely) busy with "work." As it is, I think maintainers are probably several /months/ behind on patch reviews. There are neither enough people to review patches nor enough maintainers to approve patches after random folk (like me) make recommendations. So please don't feel that you've been singled out. It is a growing pain that gdb is experiencing right now. >>> Motivation: >>> >>> When connecting to a remote system, we use the compare-sections command >>> to verify that the box is running the code that we think it is running. >>> Since the system is up and running and *NOT* 'freshly downloaded without >>> yet executing anything', read-write sections, of course, differ from >>> what they were in the executable file. >>> >>> Comparing read-write sections takes time and more importantly the >>> MIS-MATCHED output is confusing to some users. >>> >>> The compare-sections command compares all loadable sections including >>> read-write sections. This patch gives the user the option to compare >>> just the loadable read-only sections. This is excellent. Thank you for providing this information. I found it very useful. >>> Index: gdb/remote.c >>> =================================================================== >>> RCS file: /home/cvsroot/GDB/gdb/remote.c,v >>> retrieving revision 1.8 >>> diff -u -r1.8 remote.c >>> --- gdb/remote.c 26 Mar 2014 14:12:34 -0000 1.8 >>> +++ gdb/remote.c 26 Mar 2014 15:49:40 -0000 >>> @@ -8664,6 +8664,7 @@ >>> int matched = 0; >>> int mismatched = 0; >>> int res; >>> + int read_only = 0; >>> >>> if (!exec_bfd) >>> error (_("command cannot be used without an exec file")); >>> @@ -8671,11 +8672,20 @@ >>> /* Make sure the remote is pointing at the right process. */ >>> set_general_process (); >>> >>> + if (args && (strcmp (args, "-r") == 0)) >>> + { >>> + read_only = 1; >>> + args = NULL; >>> + } Two (and one-half) things: 1) It was recently agreed that we would now explicitly check pointers against NULL. 2) I think it better/more consistent to use check_for_argument (in cli/cli-utils.[ch]) for this: if (args != NULL && check_for_argument (&args, "-r", sizeof ("-r") - 1)) read_only = 1; 2.5) I'm a testing freak, so I'd really like to see is a test case. Alas, I see that there are no tests /at all/ for compare-sections, so that may be heaping more hardship onto this than is either necessary or plausible. I am not going to ask you to provide one because of this, but a global maintainer might. In any case, with the two changes above, I recommend that this patch be approved by a maintainer. Keith >>> + >>> for (s = exec_bfd->sections; s; s = s->next) >>> { >>> if (!(s->flags & SEC_LOAD)) >>> continue; /* Skip non-loadable section. */ >>> >>> + if (read_only && ((s->flags & SEC_READONLY) == 0)) >>> + continue; /* Skip writeable sections */ >>> + >>> size = bfd_get_section_size (s); >>> if (size == 0) >>> continue; /* Skip zero-length section. */ >>> @@ -12046,7 +12056,8 @@ >>> >>> add_cmd ("compare-sections", class_obscure, compare_sections_command, _("\ >>> Compare section data on target to the exec file.\n\ >>> -Argument is a single section name (default: all loaded sections)."), >>> +Argument is a single section name (default: all loaded sections).\n\ >>> +To compare only read-only loaded sections, specify the -r option."), >>> &cmdlist); >>> >>> add_cmd ("packet", class_maintenance, packet_command, _("\ >>> Index: gdb/doc/gdb.texinfo >>> =================================================================== >>> RCS file: /home/cvsroot/GDB/gdb/doc/gdb.texinfo,v >>> retrieving revision 1.1.1.2 >>> diff -u -r1.1.1.2 gdb.texinfo >>> --- gdb/doc/gdb.texinfo 18 Feb 2014 15:36:03 -0000 1.1.1.2 >>> +++ gdb/doc/gdb.texinfo 26 Mar 2014 15:49:40 -0000 >>> @@ -8760,11 +8760,12 @@ >>> >>> @table @code >>> @kindex compare-sections >>> -@item compare-sections @r{[}@var{section-name}@r{]} >>> +@item compare-sections @r{[}@var{section-name}@r{|}@code{-r}@r{]} >>> Compare the data of a loadable section @var{section-name} in the >>> executable file of the program being debugged with the same section in >>> the remote machine's memory, and report any mismatches. With no >>> -arguments, compares all loadable sections. This command's >>> +arguments, compares all loadable sections. With an argument of >>> +@code{-r}, compares all loadable read-only sections. This command's >>> availability depends on the target's support for the @code{"qCRC"} >>> remote request. >>> @end table >>> >>