From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96271 invoked by alias); 8 Mar 2018 22:32:25 -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 96257 invoked by uid 89); 8 Mar 2018 22:32:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 spammy=fraction, contributor, (unknown) X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Mar 2018 22:32:22 +0000 Received: from ESESSHC010.ericsson.se (Unknown_Domain [153.88.183.48]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 35.8A.18296.3F9B1AA5; Thu, 8 Mar 2018 23:32:19 +0100 (CET) Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSHC010.ericsson.se (153.88.183.48) with Microsoft SMTP Server (TLS) id 14.3.352.0; Thu, 8 Mar 2018 23:32:14 +0100 Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSMB502.ericsson.se (153.88.183.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Thu, 8 Mar 2018 23:32:14 +0100 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (153.88.183.157) by ESESSMB502.ericsson.se (153.88.183.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26 via Frontend Transport; Thu, 8 Mar 2018 23:32:14 +0100 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [142.133.49.54] (192.75.88.130) by DM5PR1501MB2008.namprd15.prod.outlook.com (2603:10b6:4:a1::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Thu, 8 Mar 2018 22:32:12 +0000 Subject: Re: [PATCH] gdb: Add a default_unwind_pc method for gdbarch To: Andrew Burgess , CC: Yao Qi References: <20180307220420.23307-1-andrew.burgess@embecosm.com> From: Simon Marchi Message-ID: <9253074d-d581-0028-3395-40c98fab0b31@ericsson.com> Date: Thu, 08 Mar 2018 22:32:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180307220420.23307-1-andrew.burgess@embecosm.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: CY4PR1801CA0034.namprd18.prod.outlook.com (2603:10b6:910:74::47) To DM5PR1501MB2008.namprd15.prod.outlook.com (2603:10b6:4:a1::38) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 932ae28e-8d30-4c79-d36f-08d585446fe1 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:DM5PR1501MB2008; X-Microsoft-Exchange-Diagnostics: 1;DM5PR1501MB2008;3:VMOrxm5vmR+Krb/Yr7JjfyuM/Jr44nXPjSHgqh7tUE175ngfE12zOis2uKzxx2HSrekKJE/rk4mnPBJWpvW9nt1UDbTGQLGQ1RPuAayLYQ+XV6yugqsIVoufbG72vKF6BfAGTIUrUK8nZiBun1jcKXlyi/kZGhFNniMVMGn67f5oHLi1DOPYcxMGLRG9lWN1mZ33tZOIm1897US4XuvfjvdAAA/1ryIQgh9QZ2TdgO//UFcXfsjnHX8GSwMxzIDt;25:4Z4TAQEmhoD0yTCCfd16/5aW8VQYBDqodts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Vzss1RwHdkm5CxQFjht2EhIM/49jBFN1voM3sM5b15L3p3wa4f/+S9D7r;4:Xyt8kibJveJ5RD9zFHoSN7PzJvUU9pc5NA5Mh2QWgfXKIYKK3RuHUjDxv2GC2GxNJXbQASi1eMDlVpk7zAdyAh9DLdapyusjB3r3Gi6cY/V0bZc6WPpEwZCJQG7E4VGDMJRj1Gq+E8uzMjTVVkkwoApIYCVpb6uUzKKzhYWQN3TwHZ7XQUojTcJA1CzA6YmFPFf6KRyIgEgOEPIvJ63hJ5ltDl2wYhnIkjUCkIdu2Jm21XsTL09rCKPLUt8bo7hojOtFUjQW8RguwdB7OzFOvg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231220)(944501244)(52105095)(93006095)(93001095)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR1501MB2008;BCL:0;PCL:0;RULEID:;SRVR:DM5PR1501MB2008; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(979002)(6049001)(376002)(39380400002)(346002)(396003)(366004)(39860400002)(377424004)(189003)(199004)(54094003)(7736002)(106356001)(305945005)(53936002)(6246003)(3846002)(6116002)(230700001)(25786009)(39060400002)(31686004)(66066001)(36756003)(65806001)(6306002)(65956001)(6486002)(105586002)(50466002)(64126003)(97736004)(47776003)(31696002)(5660300001)(52116002)(58126008)(4326008)(16576012)(65826007)(23676004)(68736007)(2486003)(26005)(52146003)(186003)(16526019)(8676002)(49976009)(76176011)(59450400001)(53546011)(86362001)(478600001)(966005)(6666003)(386003)(316002)(2950100002)(81156014)(81166006)(2906002)(8936002)(229853002)(78286006)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR1501MB2008;H:[142.133.49.54];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjE1MDFNQjIwMDg7MjM6c1JnMSthSTJlYzVnRms2RVZsNmt5bTFx?= =?utf-8?B?WHNEUnFPY3QxOEZ6eUNjZDFxN3VHWFNTS05POGxsV1R2cFMxUUJCQmRqbzNP?= =?utf-8?B?dHdYQmtaQmJxWFpiMmdkaXg2ZlRMbklnMWtwYWNneUNSVVNWd3daN0ZkMjcz?= =?utf-8?B?YVBuSldqUE5RU0pOSHhGRTRPcGFSejFDdm5IczhUb1VVdVNOd3BGazE3c2pQ?= =?utf-8?B?eTZiZlc5a21HVVRTQWtSQTBPNjVIaThjSUZZQU95a1JUMTVsR1FyV1cwMDZC?= =?utf-8?B?SmVXRjYrdW4vMkxhSFpGRVA2dkFNQXVDampweFdCaDBhOU5vYzJYSHlKRysz?= =?utf-8?B?elJUYzQ3a1VLR1RyaVFpY2VvbXJzbzBFR0haM2NqZTRXeUNLQ0NtQ1dHcm9S?= =?utf-8?B?ZmM2Qjk1bDRYMHRLZnZ0OFZqK2xOSC9XbTVnSHQxenFjTy9tMkpzM0xxcUFW?= =?utf-8?B?NmcySS9paWlqU3A1ZitJMUM2RU9HbHVuZ1dWeUdoSEpJcGZJZGFNREJzTE43?= =?utf-8?B?M2dZOC9QQWsxeVhKVm04cC9FT21oelJSNUVKSjJ4bHlBUzA0UUlydzRDTFlR?= =?utf-8?B?NllLMm9zWE1QVkRxcndrSjZrQUpzbWFhZk9iYWpQSjhhTnpmZnF1TDVDRlA0?= =?utf-8?B?eWw1cWp5YnVjNm8wekNhL1V6NGZUeDRMTEFNN1dTVEgzb3k1S2FBcWVGVHg5?= =?utf-8?B?T0tkVmRNWlIyRk5NTUdQT1Z3clBzdCsrMy9qYUpSaTI1UXZpU3owQitINjBU?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Hj/eReCwBddpVJUYX/wlBLBphzDYabBV+VT5pW3AkvDnSIWjHH3r1/MvuBx88cNk72svdStn5964ZsPHF8FK441vJFok14IYp+P5I1prc98=;5:5C49zhALjXsl3yizDNd42NBkRvYnInQCiLv5uhZYH9jRsYQO40Hynxr4Bw0pwzvOdKlcDQ+IQZfiaPOdJNVdRMMLKc+hUCq0Dsnj6sHi5cg+GN0m2y6SnPeoczaQIPWhN0NIED4+5K83j9HAvVK7U+r2AyNkusHPJANPvlI2HRg=;24:Etem0vtce1C8rg3bGfz6ImP/X59VkbEFghVORTLZaeyEYKbvXyW3yn5IOM+nwyZXwl4j48Jf6DDOaTaY91lnwl4jH6WZAQK6ybQ+S3qj4yY=;7:SNxnnyy9ppAa1uEe8zTSJNMXpezQW0gCae/BfZOHKEpPBWpHfnUIqBjbDp4Kz1M5miogGA3OJtPBZqo6KV8OGgNkTJabLmBVsrh7YXF2WAGqteGgBriDHHp6UuMv/Qbp6Qdp0cXgKNB5I2ghI4IGoDppNDMtlaxEPBd/ojq8oexFprXTJZs/zCrQq95GpbLH5wNatGFDLSWULVOwYped+18Yk8EDDmAJ68S63xRhd2m8Bgmhgo88vkIGTYf9VQSG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 22:32:12.0852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 932ae28e-8d30-4c79-d36f-08d585446fe1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1501MB2008 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00173.txt.bz2 On 2018-03-07 05:04 PM, Andrew Burgess wrote: > As requested / suggested by Yao in this mail: > > https://sourceware.org/ml/gdb-patches/2018-03/msg00133.html > > this patch provides a default implementation of unwind_pc and switches > over targets that I believe are "obviously" using the default strategy. > > I've been pretty conservative about switching targets over, so targets > like arc that have some logging in place, but otherwise do the > standard thing, are left with their own unwind_pc method. > > In frame.c I've removed the gdbarch_unwind_pc_p check (the predicate > is gone now) as it's assumed that all targets will have an > implementation either the default, or their own. This function is > reindented, so it looks like a bigger change than it really is. > > The problem with this patch is testing, there's been very little. I > tested that every target I could build GDB for before still builds > after this patch, which covers all of the targets I touched, however, > I've done no functionality testing on the built GDBs. > > Is there any interest in merging this patch? I'm happy to run any > additional testing if I can be pointed to some instructions / hints > for what to do. > > Thanks, > Andrew > > -- > > Many architectures gdbarch unwind_pc method follow the same pattern. > Provide a default method and convert targets to use it where possible. Hi Andrew, Patches that reduce duplication are always welcome :) Do you have access to the buildbot to at least test your patch there? It only covers a fraction of the arches supported by GDB, but it's better than nothing. We can't expect a contributor to test on all supported arches. Things that I think could be added to this patch: - aarch64 seems like it could be converted too - sparc too. It passes tdep->pc_regnum, but from what I can tell gdbarch_pc_regnum is set to the same value, so it should be equivalent. And maybe for a future patch, I wonder if we could generalize even more the default method by applying in order: 1. frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf); 2. extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr); 3. gdbarch_addr_bits_remove (gdbarch, addr) That would allow removing a bunch of other implementations. If an architecture doesn't specify a custom pointer_to_address gdbarch method, extract_typed_address will end up calling extract_unsigned_integer, which is similar to the current behavior (just a different path to get there). Arches that don't specify a custom addr_bits_remove method use core_addr_identity, which is a no-op. And for another future patch, could we apply the same treatment to *_unwind_sp? Even *_dummy_id seem like it's always the same pattern. Simon