From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5984 invoked by alias); 28 Jun 2017 19:06:52 -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 5920 invoked by uid 89); 28 Jun 2017 19:06:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=BAYES_00,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=polish, claim 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, 28 Jun 2017 19:06:48 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51205C0467D7; Wed, 28 Jun 2017 19:06:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 51205C0467D7 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 51205C0467D7 Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB6205C6DB; Wed, 28 Jun 2017 19:06:46 +0000 (UTC) Subject: Re: [PATCH 00/25 V2] Make GDB builtin target descriptions more flexible To: Yao Qi , gdb-patches@sourceware.org References: <1497256916-4958-1-git-send-email-yao.qi@linaro.org> From: Pedro Alves Message-ID: Date: Wed, 28 Jun 2017 19:06:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1497256916-4958-1-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-06/txt/msg00773.txt.bz2 Hi Yao, In general, I'm happy with the direction of the series. I was having a bit of trouble grokking the individual patches, because of missing comments, etc. I expect this will all see more polish in v3. So diffing the whole series instead, here are some comments. Nothing major, though I don't claim that I've grokked everything, yet. -- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -757,7 +757,7 @@ x86_linux_read_description (void) { have_ptrace_getfpxregs = 0; have_ptrace_getregset = 0; - return tdesc_i386_mmx_linux; + return i386_get_ipa_tdesc (X86_TDESC_MMX); } else have_ptrace_getfpxregs = 1; Seems odd that these functions have "_ipa_" in their name when they're not IPA specific. int +i386_get_ipa_tdesc_idx (const struct target_desc *tdesc) +{ + for (int i = 0; i < X86_TDESC_LAST; i++) + { + if (tdesc == i386_tdescs[i]) + return i; + } + + return 0; +} Do you really want to return 0? That's a valid index: enum x86_linux_tdesc { X86_TDESC_MMX = 0, ... @@ -3639,6 +3645,11 @@ captured_main (int argc, char *argv[]) startup_with_shell = false; else if (strcmp (*next_arg, "--once") == 0) run_once = 1; + else if (strcmp (*next_arg, "--self-test") == 0) + { + selftest = true; + break; + } This "break" means that $ gdbserver --self-self asdfausidpoasduifa works. Is that expected? Might be useful to pass down the remaining arguments to the self tests infrastructure, but you're not doing that. - Missing "m_" prefix in private fields. - Missing comments throughout; function intros, struct fields, etc. - Missing empty lines between functions in several places. - Nit but I think you should be able to replace the "std::pair" uses with unnamed structs, avoiding the mostly meaningless "first" vs "second": - std::pair array_name[] = ... + struct { type1 field1; type2 field2; } array_name[] = ... - Can we do something about the #ifdefery in the selftests framework. Thanks, Pedro Alves