From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24344 invoked by alias); 26 Sep 2014 12:05:35 -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 24332 invoked by uid 89); 26 Sep 2014 12:05:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 26 Sep 2014 12:05:33 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8QC5TMj023025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Sep 2014 08:05:29 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8QC5RaI022945; Fri, 26 Sep 2014 08:05:28 -0400 Message-ID: <54255687.30207@redhat.com> Date: Fri, 26 Sep 2014 12:05:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Jan Kratochvil CC: Doug Evans , "gdb-patches@sourceware.org" Subject: Re: time to workaround libc/13097 in fsf gdb? References: <20140922183505.GA21660@host2.jankratochvil.net> In-Reply-To: <20140922183505.GA21660@host2.jankratochvil.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-09/txt/msg00777.txt.bz2 On 09/22/2014 07:35 PM, Jan Kratochvil wrote: > Yes, it works for me on kernel-2.6.32-220.el6.x86_64 (also verified your > previous patch still displayed the warning). Thanks for the testing. >> --- a/gdb/gdbarch.sh >> +++ b/gdb/gdbarch.sh >> @@ -1029,6 +1029,10 @@ m:int:insn_is_jump:CORE_ADDR addr:addr::default_insn_is_jump::0 >> # Return -1 if there is insufficient buffer for a whole entry. >> # Return 1 if an entry was read into *TYPEP and *VALP. >> M:int:auxv_parse:gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp:readptr, endptr, typep, valp >> + >> +# Find the address range of the current inferior's vsyscall/vDSO, and >> +# write it to *START, *END. Returns true if found, false otherwise. > > I find unclear the description whether *END is the last byte address or the > after-the-last byte address. OK. Best just use "struct mem_range" instead and avoid this ambiguity whenever we need a range. That struct uses "int" for length. Although that should be fixed, that can be done independently. int is obviously sufficient for the vDSO. >> +/* Arguments for symbol_file_add_from_memory_wrapper. */ >> + >> +struct find_mapping_size_args >> +{ >> + CORE_ADDR vaddr; >> + size_t size; > > size_t and not CORE_ADDR? (This patch uses also unsigned long for this value.) I assume you means ULONGEST or some such. But, I just moved that code (and renamed it). IIRC, it's size_t because that's what the "bfd from remote memory" interface uses. This structure disappears in the next version. We can work with struct mem_range here too. >> + >> +static int >> +linux_vsyscall_range (struct gdbarch *gdbarch, CORE_ADDR *start, CORE_ADDR *end) >> +{ >> + struct find_mapping_size_args args; >> + >> + if (target_auxv_search (¤t_target, AT_SYSINFO_EHDR, &args.vaddr) <= 0) >> + return 0; >> + >> + /* This is installed by linux_init_abi below, so should always be >> + available. */ >> + gdb_assert (gdbarch_find_memory_regions_p (target_gdbarch ())); > > Is there a reason for target_gdbarch () and not gdbarch? No reason. > > >> + >> + args.size = 0; >> + gdbarch_find_memory_regions (target_gdbarch (), >> + find_mapping_size, &args); >> + >> + *start = args.vaddr; >> + *end = *start + args.size; >> + return 1; > > Here it returns 1 even if the vDSO was not found. > It will return *start == *end so the current only caller behaves correctly. > But I do not find it fully compliant to its gdbarch.sh documentation. Yeah. The next version will make that clear in the documentation. >> >> static void >> add_vsyscall_page (struct target_ops *target, int from_tty) >> { >> - CORE_ADDR sysinfo_ehdr; >> + CORE_ADDR vsyscall_start, vsyscall_end; >> >> - if (target_auxv_search (target, AT_SYSINFO_EHDR, &sysinfo_ehdr) > 0 >> - && sysinfo_ehdr != (CORE_ADDR) 0) >> + if (gdbarch_vsyscall_range (target_gdbarch (), >> + &vsyscall_start, &vsyscall_end)) > > This is a code cleanup part of the patch which could be separate. OK. The next version splits this out to a preparatory patch. Thanks. I'll be posting the new series in a bit. Pedro Alves