From patchwork Fri Jun 8 12:04:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 27709 Received: (qmail 85395 invoked by alias); 8 Jun 2018 12:04:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 85380 invoked by uid 89); 8 Jun 2018 12:04:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-19.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=H*r:Sun, writebuf, annex, readbuf X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 08 Jun 2018 12:04:35 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 06A59194D for ; Fri, 8 Jun 2018 14:04:31 +0200 (CEST) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xT+nHDrQIggh for ; Fri, 8 Jun 2018 14:04:28 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 1C3B0194B for ; Fri, 8 Jun 2018 14:04:28 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id w58C4Rn1002367; Fri, 8 Jun 2018 14:04:27 +0200 (MEST) From: Rainer Orth To: gdb-patches@sourceware.org Subject: Fix procfs.c compilation Date: Fri, 08 Jun 2018 14:04:27 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 procfs.c currently doesn't compile on Solaris: /vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In member function ‘virtual target_xfer_status procfs_target::xfer_partial(target_object, const char*, gdb_byte*, const gdb_byte*, ULONGEST, ULONGEST, ULONGEST*)’: /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:2577:20: error: invalid use of member function ‘target_ops* target_ops::beneath() const’ (did you forget the ‘()’ ?) return this->beneath->xfer_partial (object, annex, ~~~~~~^~~~~~~ /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:2577:27: error: base operand of ‘->’ is not a pointer return this->beneath->xfer_partial (object, annex, ^~ /vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function ‘void _initialize_procfs()’: /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3734:15: error: invalid initialization of reference of type ‘const target_info&’ from expression of type ‘procfs_target*’ add_target (&the_procfs_target); ^~~~~~~~~~~~~~~~~~ In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40, from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24: /vol/src/gnu/gdb/gdb/local/gdb/target.h:2305:13: note: in passing argument 1 of ‘void add_target(const target_info&, void (*)(const char*, int), void (*)(cmd_list_element*, completion_tracker&, const char*, const char*))’ extern void add_target (const target_info &info, ^~~~~~~~~~ /vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In member function ‘virtual char* procfs_target::make_corefile_notes(bfd*, int*)’: /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: too many arguments to function ‘gdb::optional > > > target_read_alloc(target_ops*, target_object, const char*)’ NULL, &auxv); ^ In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40, from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24: /vol/src/gnu/gdb/gdb/local/gdb/target.h:341:40: note: declared here extern gdb::optional target_read_alloc ^~~~~~~~~~~~~~~~~ /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: cannot convert ‘gdb::optional > > >’ to ‘int’ in assignment NULL, &auxv); ^ Fixed as follows. Built and ran make check on 64-bit Solaris 11.5/x86 (amd64-pc-solaris2.11) only. Ok for mainline? The fix is mostly based on pattern matching in other similar files, given that my command of C++ is close to non-existant. Evaluating make check results is hard, too, given that the Solaris results are relatively bad even on the 8.1 branch. Here's the summary for mainline === gdb Summary === # of expected passes 42711 # of unexpected failures 2639 # of unexpected successes 12 # of expected failures 42 # of unknown successes 3 # of known failures 61 # of unresolved testcases 29 # of untested testcases 95 # of unsupported tests 183 When looking into fails new from the top of the 8.1 branch, nothing really stuck out (at least to me). # HG changeset patch # Parent 771dfa359ac98211d3f85ce89d13933d549881b2 Fix procfs.c compilation diff --git a/gdb/procfs.c b/gdb/procfs.c --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -2574,7 +2574,7 @@ procfs_target::xfer_partial (enum target offset, len, xfered_len); default: - return this->beneath->xfer_partial (object, annex, + return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset, len, xfered_len); } @@ -3731,7 +3731,7 @@ void add_com ("proc-untrace-exit", no_class, proc_untrace_sysexit_cmd, _("Cancel a trace of exits from the syscall.")); - add_target (&the_procfs_target); + add_inf_child_target (&the_procfs_target); } /* =================== END, GDB "MODULE" =================== */ @@ -3851,8 +3851,6 @@ procfs_target::make_corefile_notes (bfd char *note_data = NULL; char *inf_args; struct procfs_corefile_thread_data thread_args; - gdb_byte *auxv; - int auxv_len; enum gdb_signal stop_signal; if (get_exec_file (0)) @@ -3894,14 +3892,12 @@ procfs_target::make_corefile_notes (bfd &thread_args); note_data = thread_args.note_data; - auxv_len = target_read_alloc (current_top_target (), TARGET_OBJECT_AUXV, - NULL, &auxv); - if (auxv_len > 0) - { - note_data = elfcore_write_note (obfd, note_data, note_size, - "CORE", NT_AUXV, auxv, auxv_len); - xfree (auxv); - } + gdb::optional auxv = + target_read_alloc (current_top_target (), TARGET_OBJECT_AUXV, NULL); + if (auxv && !auxv->empty ()) + note_data = elfcore_write_note (obfd, note_data, note_size, + "CORE", NT_AUXV, auxv->data (), + auxv->size ()); return note_data; }