From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2070.outbound.protection.outlook.com [40.107.21.70]) by sourceware.org (Postfix) with ESMTPS id 66C4F3858D1E for ; Mon, 6 Feb 2023 09:10:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 66C4F3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IXwuOhuhinUzqxhb3pLmW8iwok/jzcW4QYcJ7tRyGJ0=; b=7eSfPgfwkDVQOMo6SKLI3ppd7ume1QtvGApOaxpYn5Gxjv4Vei2ZveTJZ2gxgPGPDA4d4ykgpgjWMK3auaaxJgo6AhQbQy89jDiyG6scC7Hgi2sUDXrGwuU9c3elhKRog8KTqsEEO6M1x4wGBP/Ww/ISA7XxYniKqvBdiccJp30= Received: from DB9PR02CA0018.eurprd02.prod.outlook.com (2603:10a6:10:1d9::23) by AS1PR08MB7475.eurprd08.prod.outlook.com (2603:10a6:20b:4dd::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 09:10:22 +0000 Received: from DBAEUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1d9:cafe::f1) by DB9PR02CA0018.outlook.office365.com (2603:10a6:10:1d9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34 via Frontend Transport; Mon, 6 Feb 2023 09:10:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT009.mail.protection.outlook.com (100.127.143.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.32 via Frontend Transport; Mon, 6 Feb 2023 09:10:21 +0000 Received: ("Tessian outbound 3ad958cd7492:v132"); Mon, 06 Feb 2023 09:10:21 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: def7d14b667f5c58 X-CR-MTA-TID: 64aa7808 Received: from 4a4890eee6ab.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 61D31DF1-B4CE-4CA6-9B4B-B4A8030FE6C1.1; Mon, 06 Feb 2023 09:10:14 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4a4890eee6ab.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 06 Feb 2023 09:10:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KtUHGuY0XRsLqm9ZcQpQ/dGQNhUNoDlc/lHRHTxhXwbwNVAhDWEA/gS6OMiChSEErHb6foJ97xUwtgGJkQZvJ3vKHq/uf+npi3H9yCtiRyQTuguDdeFNnwdmFhzyD0HFzJ58nkCdLn2rj3oJpLjla+mYm3jFKreglvnSGEb0Ai63mEra0HiGKG/L+nzApL/6Btuh5Msyd4YkdJRxVJRuHGk+xx+b0bTCRKrQC8mZ7UTmTrWjVu47UN4xLt0g114AyqWuXDXbjGYUgWeO/4g2ZLEZMuc5aOwjzsmLNdtsqzzuzNhVJm/M73Dn+gn+/mRe1gVxg25INi63RQQdHfMRKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IXwuOhuhinUzqxhb3pLmW8iwok/jzcW4QYcJ7tRyGJ0=; b=DCr0C02GmTGleGiGdqy2GRDlkuyF8IINoSPaiLK1/lRKjVrHeirytZQj8khvKZANdEzSiRx8psM5+hpkRa1k6rOY1Ha7jI3jN6I8ZIcHUaBgYFAm7hVhM3eLcWZ66gHJSNzIsi6GaIP4EYIt/cJupZg4FWX7uYcgUqkSyiuA6isppgNdUMsNpSiFC67/vDiQ0rRqkWK95WqozlUbrXjsAoWzLbyDxfsjmwUpf97OtboZxKCA3bCOw3bxe+ePvnu7qC2DawMWMV9snFA+kQAc52/OORdauePcHMsksi+OOJNaxeLWxZfls5wVmQj04TEJw+FyvTH8QU4L+9k6X8YFlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IXwuOhuhinUzqxhb3pLmW8iwok/jzcW4QYcJ7tRyGJ0=; b=7eSfPgfwkDVQOMo6SKLI3ppd7ume1QtvGApOaxpYn5Gxjv4Vei2ZveTJZ2gxgPGPDA4d4ykgpgjWMK3auaaxJgo6AhQbQy89jDiyG6scC7Hgi2sUDXrGwuU9c3elhKRog8KTqsEEO6M1x4wGBP/Ww/ISA7XxYniKqvBdiccJp30= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by DBBPR08MB6075.eurprd08.prod.outlook.com (2603:10a6:10:207::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 09:10:13 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::bced:32a3:b77e:90a6]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::bced:32a3:b77e:90a6%3]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 09:10:13 +0000 Message-ID: <03fabbae-14ea-67bd-b9f4-984d43e0afc0@arm.com> Date: Mon, 6 Feb 2023 09:10:12 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v3 6/8] gdb/remote: Parse tdesc field in stop reply and threads list XML Content-Language: en-US To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org References: <20230130044518.3322695-1-thiago.bauermann@linaro.org> <20230130044518.3322695-7-thiago.bauermann@linaro.org> <249be3dc-668e-9aa3-d3cc-5fc9fea3f99a@arm.com> <871qn5m0v6.fsf@linaro.org> From: Luis Machado In-Reply-To: <871qn5m0v6.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0455.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1aa::10) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DBBPR08MB6075:EE_|DBAEUR03FT009:EE_|AS1PR08MB7475:EE_ X-MS-Office365-Filtering-Correlation-Id: 03e8176c-9251-4b63-ae2d-08db0821f98d x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: hDcl4YJ09Y3RF5cZkZfLyGXX+oE6tJ1jOIAUEGSc5+MPqq8skuo4ErTK89iR39faZ9O1Kz7TZcL/J5lNrWyTDF3PesUymwCjVndgSW9rZV61a1TvS+DJI97Ro6EOY9nKVakR9IeJb53l91WZzxvolADJolioIc+gQ1CI8NFndJogLuJq3J8qH9MRrROGlJ+HG8sbmqCKubrvWQAmavneiM+cXmSr8plrTqXD7vUcvjhPLrAPLfjOw8saNOkXo70aPl9D8ZKWrXAqNtSbWFxKHAzcDDyqMIoH2cMeIZbNeXYgv3On7xAS2VsnaJXZHpvAK21ribf2cP9N8xh9ByRtDR8fQQ9PcbLy4Ta61tT+PeqlYmSHeUcJmoCx3fEocAYRKhso4jRribBNhFMLQMsN/gMnV2FJYkh5zZ9dzqWWFLHJki9mnxEzBofMkfoWffwtvVw9FU3Fb1AX4U1QWvIt8XYM9Gpqa4edhCFszcWMvB/rQCpv+XBQV58I1eH20EQpECJlhhGHHYrKxqtPTusB+R7C7dC3uKhuDScGo8+HFZ3/GK8fFkypScDsDqV2WdNzzLdS0qw0cD/CWQIWvAN8FMJISqyjoi0+am5PWxCTfKPf557hYnhY378UY3Z9JQ67dCFtpSpEse9RnOGS/Rj+it9XGGwZYDyJhwv9TdqUabW260Iy4GiCd2XmjCGPPbjHkwcAGS1v5bXmJcsd6LhjvrnmhAl8uxSrm9VKvow1HmE= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB3919.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(346002)(376002)(396003)(366004)(39860400002)(451199018)(66899018)(66476007)(6486002)(53546011)(478600001)(2616005)(6506007)(6512007)(186003)(26005)(4326008)(8676002)(66946007)(6916009)(316002)(66556008)(36756003)(31696002)(86362001)(38100700002)(83380400001)(5660300002)(44832011)(41300700001)(8936002)(2906002)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6075 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 2a3582dd-b753-4ebb-71ff-08db0821f43e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LuripP8N/JvmoSaLmNWrO/2ph2flLcxjRDlAIBfEnByNMtXgdWLAifRfDVK1YNfVPPVTrRFO7lkkcHlVwvtUHKauGUv60i4dV4Xa7UArbF8jIuTW19TFgUyzPTUMBeqbIfzYRmwfOsDjLRAcxVLXXhFJPAjsM6HhU80YFpjUkD79LNU9YBVd4lsGvVCr05GpSbga3TMJm3sfv8vyaqdZFvZ3GPUAzlwFChBhCNUV9R4m3c1Ak/K2dEQzoK4gWQIAmFWNr4VNMMfTQd3pPrMnXwTtK4uA8pdC18dzRERytl9SSNveQQ3MUIKqy7K7xilTIYkhGkRCfUOs8kEGC4FJ73Y8mcb6Nd/tzkCpUOEyna+yHQyEC6iOXE84jmnaTtiAdm4fjk5zqpj4FBE8XcKSfreijOySQwTqZtybISQeSroblrYjEnRvD4KQSv1HwipLY8HCk3I1Ry/6dvVQ74zpxC35DSvBXxUKFC5geV9xcY67hAF7Walo+O8WOxVtePMGDgGFS0zvXfj9Jmy/INDSRw46tLQ8Kw49DPDqZOADRjb3pn6jIpmrgysZQ5ATCx1ridcXeBOz8VaPhOwuHTCde10iTW/v9tjdyxk2hnAodyVqWkkLkKeC+B0Pm/YY9ao7jUrRMO7N5VgOmmnEXN4lbGKSS44OizhClUOUtpMcEH4mkAJ7B6m14tHMVgT/YF0QB7apNAFD2qu5J3g+IDymJqE9991BauGFvzhVJwj3Ucc= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230025)(4636009)(376002)(396003)(346002)(39860400002)(136003)(451199018)(46966006)(36840700001)(40470700004)(53546011)(6506007)(31686004)(356005)(478600001)(2906002)(86362001)(31696002)(82310400005)(81166007)(186003)(6486002)(26005)(2616005)(6512007)(82740400003)(66899018)(5660300002)(44832011)(8936002)(36860700001)(36756003)(6862004)(41300700001)(336012)(4326008)(70206006)(8676002)(70586007)(40480700001)(83380400001)(40460700003)(47076005)(316002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 09:10:21.6655 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 03e8176c-9251-4b63-ae2d-08db0821f98d X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR08MB7475 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2/5/23 00:06, Thiago Jung Bauermann wrote: > > Luis Machado writes: > >> On 1/30/23 04:45, Thiago Jung Bauermann via Gdb-patches wrote: >>> --- a/gdb/remote.c >>> +++ b/gdb/remote.c >>> @@ -80,6 +80,7 @@ >>> #include >>> #include "async-event.h" >>> #include "gdbsupport/selftest.h" >>> +#include "xml-tdesc.h" >>> /* The remote target. */ >>> @@ -238,6 +239,16 @@ class remote_state >>> /* Get the remote arch state for GDBARCH. */ >>> struct remote_arch_state *get_remote_arch_state (struct gdbarch *gdbarch); >>> + /* Add new ID to the target description list. The corresponding XML will be >>> + requested soon. */ >> >> Will it be requested soon or can gdb just ignore it if the user >> doesn't switch to that thread? > > In this patch it would be requested soon, right after the threads list > XML and the stop reply packet were parsed. > > But in my local branch that will become v4 I implemented Andrew's > suggestion of getting the target descriptions on demand in > remote_state::get_tdesc so now GDB may indeed ignore it. > >> If gdb can ignore it, then it might be nice to mention it here that >> gdb can chose to request it at any point in time, but may opt not to >> do it at all. > > As a consequence of Andrew's suggestion, the add_tdesc_id method isn't > necessary anymore, so this comment isn't present anymore. > >>> + void add_tdesc_id (ULONGEST id); >>> + >>> + /* Get the target description corresponding to remote protocol ID. */ >> >> s/remote protocol/remote target description? > > I meant that in the sense of “ID that is used in the remote protocol”, > but I agree it's more confusing than helpful. I changed it to: > > /* Get the target description corresponding to the given remote target > description ID. */ > > WDYT? > Looks good! >>> @@ -3814,6 +3844,13 @@ start_thread (struct gdb_xml_parser *parser, >>> attr = xml_find_attribute (attributes, "handle"); >>> if (attr != NULL) >>> item.thread_handle = hex2bin ((const char *) attr->value.get ()); >>> + >>> + attr = xml_find_attribute (attributes, "tdesc"); >>> + if (attr != NULL) >> >> s/NULL/nullptr > > Fixed. > >>> diff --git a/gdb/xml-tdesc.h b/gdb/xml-tdesc.h >>> index 0fbfc7e043e9..c7cc97c5dfc0 100644 >>> --- a/gdb/xml-tdesc.h >>> +++ b/gdb/xml-tdesc.h >>> @@ -38,6 +38,12 @@ const struct target_desc *file_read_description_xml (const char *filename); >>> const struct target_desc *target_read_description_xml (struct target_ops *); >>> +/* Read an XML target description with the given ID using OPS. Parse it, and >>> + return the parsed description. */ >>> + >>> +const struct target_desc *target_read_description_xml (struct target_ops *ops, >>> + ULONGEST id); >>> + >>> /* Fetches an XML target description using OPS, processing includes, >>> but not parsing it. Used to dump whole tdesc as a single XML file. >>> Returns the description on success, and a disengaged optional >> >> I noticed we're dealing with the target description id as ULONGEST on >> gdb's side, but as unsigned int on gdbserver's side. >> >> Should we make them the same, if possible? > > My thinking was that since it's gdbserver that defines what the ID will > be, it can use a simpler type (2³² target descriptions should be enough > for anybody) since it knows what kind of IDs it will issue. But GDB > doesn't know what the remote stub will want to do, so it should use a > big type. > > But with Andrew's idea of passing a value during target negotiation to > decide whether the ID will be a number or a hash, then we can use > unsigned int for both types. > Got it.