From patchwork Thu Nov 16 08:09:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 24283 Received: (qmail 32201 invoked by alias); 16 Nov 2017 08:09:46 -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 32187 invoked by uid 89); 16 Nov 2017 08:09:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-HE1-obe.outbound.protection.outlook.com Received: from mail-he1eur01on0082.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (104.47.0.82) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Nov 2017 08:09:43 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0104.eurprd08.prod.outlook.com (10.160.211.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Thu, 16 Nov 2017 08:09:39 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::2891:52f2:59:8e54]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::2891:52f2:59:8e54%16]) with mapi id 15.20.0218.015; Thu, 16 Nov 2017 08:09:39 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd Subject: [PATCH] Allow osabi to be optional in target descriptors Date: Thu, 16 Nov 2017 08:09:39 +0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM3PR08MB0104; 6:q/heolra24tk9HMbnQXaN/XnXto3XHbmoGDqbfiNdMb/q0y48eNGnIMhS6WfN6yAz23QMKVCP8UY61vk88tNR0BTPxMdJOBoqEJeqorhn/KIa/YT/4uQxbbwtsVDYI1bwBYktslVUVsbCcZ/Spypb6nCH4OGxQBLNqT+ITjkcJfS4zKLq1l2vrw8AC0Eb2RqIEMdXxDeC46Hzx5syfvucUC5XzYoWlMiNSbUYpKBbcASgH+r4BmInZV8xwp5gODHVvUOwqlTdzakYkF1NTctlseqifrYcFAlCwKgV5+EH+lbzZ2DYviEYshHFw45JZgfGIvihhHxBxyIQ5DguM7hRYrX31AGIpYjSZKRp2HspnQ=; 5:4yOPBhCx2GuGHvFqUGMljHel3r8DPYXY78USF3UogIFw2tTg2FvBMOOGNB3xheHLQde0Uy580DAU2lTucRhTHGmNb+d9tcot6RnG/j/5oJGOtGB9olRq//2t2PnnI3WTeCbcKU8jFtKm0Tb0eoNYkrqWtI3wbJAqUJ6/FhuLfO8=; 24:OKRT8Z/kMvdpHnEwJn7AKx5ywU26GMjYRHAJLKfsHGJTgwlKbTV0L8GIEKZ0K+qYiLxMQx0W2xYBPKUIcacW+h56tPBD2Wyvbjt/8rKkBS8=; 7:EZZ9vNS/KDjAo0+Y3hAv3RbuNqxQXaPQ63zlPWd6abNMmqzXyJuZbcMzgezCh+mVzNgODk5WdWZBIa+UZ/ktF7ZN8U7BOx8/z3LNasJCQ35260RGg/BJGrbzbX44nagrQ7UFzgIPRXnkXpMWMo/DJgzAwwZrtSBzDq+jAtuhGRzRWQEeAzp7lXUQCNXiAQvNhoLwUqsytUiE9u/iwmeeLfzKhHvvWW+j7OY9h/rK4ylidBIDFnV+3QIZR70eD7GV x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: f69d562f-e760-4414-665f-08d52cc96295 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:AM3PR08MB0104; x-ms-traffictypediagnostic: AM3PR08MB0104: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3231022)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM3PR08MB0104; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM3PR08MB0104; x-forefront-prvs: 0493852DA9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(39860400002)(199003)(377424004)(189002)(8936002)(102836003)(101416001)(5640700003)(6436002)(14454004)(25786009)(66066001)(81156014)(86362001)(2906002)(6486002)(53936002)(5250100002)(4326008)(3846002)(6506006)(6306002)(6116002)(575784001)(6512007)(3280700002)(68736007)(33656002)(2900100001)(3660700001)(8676002)(81166006)(305945005)(2351001)(966005)(5660300001)(7736002)(6916009)(4743002)(189998001)(106356001)(50986999)(478600001)(36756003)(54356999)(72206003)(83716003)(2501003)(105586002)(97736004)(99286004)(4001150100001)(316002)(82746002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0104; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <465A3709A8E2A34C80FA67CB8FBA6AD7@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: f69d562f-e760-4414-665f-08d52cc96295 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2017 08:09:39.5862 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0104 X-IsSubscribed: yes Osabi is an option field in target descriptors, according to: https://sourceware.org/gdb/current/onlinedocs/gdb/Target-Description-Format.html However, removing the osabi field from the i386 and amd64 target descriptors will cause gdbserver to assert. This is code I used to test (not for committing!) : diff --git a/gdb/arch/amd64.c b/gdb/arch/amd64.c index 30c73e642f..5c63a6c223 100644 --- a/gdb/arch/amd64.c +++ b/gdb/arch/amd64.c @@ -41,9 +41,6 @@ amd64_create_target_description (uint64_t xcr0, bool is_x32, bool is_linux) #ifndef IN_PROCESS_AGENT set_tdesc_architecture (tdesc, is_x32 ? "i386:x64-32" : "i386:x86-64"); - - if (is_linux) - set_tdesc_osabi (tdesc, "GNU/Linux"); #endif long regnum = 0; diff --git a/gdb/arch/i386.c b/gdb/arch/i386.c index 7d71506a7b..112c0a89e6 100644 --- a/gdb/arch/i386.c +++ b/gdb/arch/i386.c @@ -37,8 +37,6 @@ i386_create_target_description (uint64_t xcr0, bool is_linux) #ifndef IN_PROCESS_AGENT set_tdesc_architecture (tdesc, "i386"); - if (is_linux) - set_tdesc_osabi (tdesc, "GNU/Linux"); #endif long regnum = 0; The following patch fixes this error. Tested with gdbserver on x86 and also on aarch64 with my target descriptor patch. Also ran make check on x86 with unix and native-gdbserver. 2017-11-16 Alan Hayward gdbserver * tdesc.c (tdesc_get_features_xml): Allow null osabi. diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c index 63d6467d56d168777f4fa39b56495dd5649c046b..72603d626f005821a8b866d60cfdfca112c1395c 100644 --- a/gdb/gdbserver/tdesc.c +++ b/gdb/gdbserver/tdesc.c @@ -92,8 +92,7 @@ tdesc_get_features_xml (target_desc *tdesc) /* Either .xmltarget or .features is not NULL. */ gdb_assert (tdesc->xmltarget != NULL || (tdesc->features != NULL - && tdesc->arch != NULL - && tdesc->osabi != NULL)); + && tdesc->arch != NULL)); if (tdesc->xmltarget == NULL) { @@ -105,9 +104,12 @@ tdesc_get_features_xml (target_desc *tdesc) buffer += tdesc->arch; buffer += ""; - buffer += ""; - buffer += tdesc->osabi; - buffer += ""; + if (tdesc->osabi != NULL) + { + buffer += ""; + buffer += tdesc->osabi; + buffer += ""; + } char *xml;