From patchwork Sun Dec 31 03:48:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 25156 Received: (qmail 126032 invoked by alias); 31 Dec 2017 03:48:49 -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 125978 invoked by uid 89); 31 Dec 2017 03:48:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:dw_at_d, sk:DW_AT_d, sk:dw_at_u, sk:DW_AT_u X-HELO: sessmg23.ericsson.net Received: from sessmg23.ericsson.net (HELO sessmg23.ericsson.net) (193.180.251.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 31 Dec 2017 03:48:36 +0000 Received: from ESESSHC016.ericsson.se (Unknown_Domain [153.88.183.66]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id C7.0B.31026.11E584A5; Sun, 31 Dec 2017 04:48:34 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.66) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 31 Dec 2017 04:48:33 +0100 Received: from elxacz23q12.lan (192.222.251.162) by DB4PR07MB315.eurprd07.prod.outlook.com (2a01:111:e400:982f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.3; Sun, 31 Dec 2017 03:48:28 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH] dwarf: Make sect_offset 64-bits Date: Sat, 30 Dec 2017 22:48:18 -0500 Message-ID: <1514692098-8054-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-ClientProxiedBy: BN6PR02CA0047.namprd02.prod.outlook.com (2603:10b6:404:5f::33) To DB4PR07MB315.eurprd07.prod.outlook.com (2a01:111:e400:982f::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d47c138-a038-4c29-77a7-08d550015adf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020020)(4534040)(4602075)(4627136)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:DB4PR07MB315; X-Microsoft-Exchange-Diagnostics: 1; DB4PR07MB315; 3:PA3pMpptHaBXGRBO1w5u8QA4WVdbqZcE1n2SfgoXFAGLJcFg38NXeh0sjXvzlxlz8BEI6PdE7NDvJiSwS0gNZhFJp/lxHyp10QSyd7SNNflQhqFXQISz2gGbXI1orT+lt67VP5J4KM4vdqMG6+ZVZg37D92NyPbhhzUUWYw2Y5qmkUj2nyzB92Flfjkm6xLFG3ZlArASTW2y1UqQDkM1pyXRoHh2qjk0x4+bvle/2Oapde3hIVxoXytskYAf2x9h; 25:72fa/RP0sHTukkC4+HmD0+xO05icFE7dDphp0meDTuXA6F8YNEGdQplzA6ddvaE12lI5N5ecvyzM9DfLM3WDYnOTnjba8lWyXAlIXTAOzlR9cyIU9fK7IWCsGxbi+EC9+AORw7RZ/DRvpj/xmZ4PeuIytrbNR2dFZaCaLBMMec1LClsP+bp7BgqlLF85CEfgqofmcycFNPxvG+ylj/4X/lstVZ/Ce/Q+T2tRVOv5VU2XbTk8gyhpzuPxIYfwJ6/xqPtqFudavMe6PZmzf3RmrcplL75yZCBprwp6KvOvWuwrMb3aeD8TDSzcAakRQ2/6NFg1bisaG+KtJA3R0yct8Q==; 31:CmyYHKOhG9353ZdLrb67t0VR4yLFuN0hfo2QEaPXi44C/vSerMpFh1brZs6MEuVeM5nttRnWTaDTnzMmFqEYtMif40ASHyj724+MUdr9GRXwoks3hJN3OkLJ99vmedPId/8nLyDtsn+ES2xRB3rKhjwKdZhXtqsAA4PsMyxQK+daGZXORu49jQMBupTahKuMN3lJeZ8QGDicO3muxnNJNWKgoTjhZ5xbRDONHXam4kk= X-MS-TrafficTypeDiagnostic: DB4PR07MB315: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; X-Microsoft-Exchange-Diagnostics: 1; DB4PR07MB315; 20:1IsgBVe+1LYji8mAitltVdZdC0dMVKmhLQA0AuJkN46vudnPSf75J50TWer1IR/UKNz2fOxtqKJLUTxA0Kg416qWrfWR26w5PN8KqHWCZYcduJhY++TuJGH/s++R+IwxadeEdlGSYp3YYmAppQ9P1Lzf3NKQiKzcdjG+AQoOrPtH5pzNzTfy2Oci+r6uv/riDoaVC6hWR9gHhRmytFYFaH7qDGrp1qC9vCgNG5bWZ7bc2uxNYxehE32bDr4R64AFRy5hHQVOkeTYGnLWdszEWuOqYAoTA7UeyxFEF7LTfpunTgnmDOjaBlLQn86r53i6hlNGd77+IoUh1RBX2cahrdwQJippY66GvFowaXzzjn1hE6WP3vELlQYt2EngS65FIdRA9HybXVpTsUHbmKemwxAaTfSdsOpa7xaVeF85W+lJF99qYAEbRFq6oL/WxU0dBfDX7No4DCOw7CZGD6THxnVdn/p0SdFQG2bXjgELt3vStl21vJ2LPXnYzJ/FdkvI; 4:ysaBcGcTUgP/dSIi9WfX7wvQ4XcOLbQrBTSla8Lxc5CiJtQZoeXGVqFHHddZXUXiUlEFhTVtjUKRip9NKVXJRJ55xhXjNz3n0YE7LMOZ+G1vmh4+KGDpKTKJ0ONdsjHuTyBo74KlPfA9x5XUiMqxviK9mfwtUAxDZ9kOeJREmiutnnK3MmwuoE/9DvrWa/itwUPVwfDCRFOl6/vNAIBsbLY3qLx8oEi1Poina2KIrzXwTisba/slrJl1qXEZe2NtOJRNR1Zno/fRhnE4UBUPzA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231023)(944501075)(10201501046)(3002001)(6041268)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DB4PR07MB315; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB4PR07MB315; X-Forefront-PRVS: 0538A71254 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39380400002)(376002)(396003)(346002)(39860400002)(377424004)(54534003)(199004)(189003)(48376002)(50226002)(4326008)(51416003)(107886003)(6916009)(50466002)(47776003)(21086003)(52116002)(6666003)(81156014)(16586007)(86362001)(316002)(53936002)(8676002)(53946003)(66066001)(81166006)(8936002)(68736007)(3846002)(6116002)(97736004)(305945005)(7736002)(6506007)(478600001)(36756003)(386003)(6486002)(2351001)(25786009)(106356001)(2906002)(5660300001)(2361001)(105586002)(69596002)(16526018)(6512007)(59450400001)(579004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR07MB315; H:elxacz23q12.lan; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB4PR07MB315; 23:H9gXLDO4pUrO1Y7KJfamX5gm4DGz2DppchJOgnYso2?= =?us-ascii?Q?RNDW10NtmNISWG7Icb7X9htDh98Hbr197E9Z6EhjvN+v/niVNoG+VnNguveS?= =?us-ascii?Q?wRDRo4xBGJo6b/z561s1F1Pibxg/erg/4Z0EqsPF8M19NnFLw/aeOJVv52Zv?= =?us-ascii?Q?qEnwOZaJ061h3vAG+pS0D53MG+eaOs6JdDeJn5xT/Np98kQORTwEfa0kwnrb?= =?us-ascii?Q?v/mFQzJOMmOlehspoEJsAOVzWXIs1OBDFV3vn8N3GbH7pMEVFNtcLlMY3R1H?= =?us-ascii?Q?lgvQu1JZjIDNPJADJatHalpY+v63UkQpGL7EAG3dfdz1RMNUmr+D1ObV5rvO?= =?us-ascii?Q?thp+twiKyJQCIMpa/Owasm960K9v9zWo+319SO2i4VUUA0vRTZj9QavUCvn3?= =?us-ascii?Q?n371XospDbdwL4eMxUnII4AALXykPHRX8pz8L44AUMmpn3t6da3j64vEFhH9?= =?us-ascii?Q?chRK3D9854gN4B5+GF4DWWnaXYy2W2Sh/qrMFMXo95A6A6wX6HqojEzlGgNQ?= =?us-ascii?Q?rQLMNAmNOzsCNQs1eXFbBmLy4cI65ZFQ0QO00yveRlWYc2wzOHoF+sJyCm9X?= =?us-ascii?Q?ZwAGc7jzIjbN5aPo6HWVNFJ2UiJvV2K+5H/lGz6VtyhTPvzYjNKtTe99Yzd/?= =?us-ascii?Q?3d6rImnKyBJOjrF8hMZaFHjBkoNvtmMK0NxxV2PaiiaK5xtBjCkDClezFAQj?= =?us-ascii?Q?D0AhULLXFKRII84YxEIS5EVomfCQypVZ1TuyLi/Ttt9xHDgiP0a+PDsWY/G4?= =?us-ascii?Q?vDRzYnesFcodR7B3JjQUvk8FvHgh3/4rRugH7cL9s4C7/UMmMAuyyiGqvaFH?= =?us-ascii?Q?EvUQtJr/n8dk9mejal66dsLzyO/KPz94znPlfFkRYIo4emq9WyMoNSHaaVUo?= =?us-ascii?Q?qN0TR1Rru1Pb7hAqO0dcWMQ38Fin7GdgJLdZguSqDR5ow/zxdUSluPqzeI9N?= =?us-ascii?Q?OiazGCsrFbsWuwyRSgVVHvidA/PcJRQ7LMOrPGoPX7DdaDgVbTzpsIIViY6I?= =?us-ascii?Q?2j4/8K/5w7AW/vblAv+YbI3NbSqEoQa1bXfNsiecw0x+pMkku4sjRWEs+haw?= =?us-ascii?Q?n19oxNc6jOiYhfdUYHELE8QAmEMGtQyM8Ki1i1UEh1WnpPtGx4FZt85pJPrc?= =?us-ascii?Q?hBUF+8dT5kaKcXeqrK3gSFhQmFjPVOmclbdWMwZd2f3+0XzfS+mKbgZstnEc?= =?us-ascii?Q?BrAnAKY9rYQjmPBp3Bt7X0STCpnzYL96QgJ8DHu7jD0Y5jIS/DJk4NuxLTu2?= =?us-ascii?Q?2Wz2QFpJBD/fEp3w4=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB4PR07MB315; 6:l1KNOn411fjIynudEIoeQgkwOehVnSKAVhBcMV+XCja7aPmecLCcYiL13QueMnSBNykdywVqB1d2FID+8T0axN0E1xave2NXqsgWTiKSMJT//zBvlWu5mG383/SHLRjK/ChglfqPczGeNGitWo8IPCUws6zj1wv9e3RDYnAZcDwZtnGsks+n/T3sjD3E6+WhWrEpTllDa2r2eutI2NuN0J1rwKmeHeyzkNlehB23wufsuGU01STYnG2JBpPeve4xxzcQr+kEHCaFSEvpnf2ZESITROiL7w0LsRvO19R/cPSLU5khzF3i4Va63jEpzp2dsKi94lDFJMlSYEBJ6vXYRzX980OWpdZmAumOsfTTS/4=; 5:GEZF24BQnFALHq8GAxOk6IrYvNDpmK/XCkKqeYUbHi7Yv70IaxnCk6b/L8vZ+AI2pOSO0HDNjGJccSzRAaDKoDljeMGRKvKo3rKpfr3+eYO2dvtdJVtst1XvB5Jm+lBvrdO6kpRF2qAXxmawRT7j6JeiQ03vg66hJbNLUjNMeNc=; 24:LdiqOf4Ds/3CEPU+Rg++s+usUIFeJDVUxbl6F6wCAdxeFtT4LTA3+KRanoan/wS/Y253SDkF6yISUKLJ8EuyAVL8UddzHUaHFi0c1noS8W4=; 7:vPuYWsM9oGaS97ssPy4iyQX2oFEQBgmJGeEb+nhXrz7kDMer5QWrbPUONOkvNXheOI5VzUK4ulDVhLfXyHC9+ZCR65cNFwqfT9ltyOpCP6MzAUbnlBj3JhHsOrU3LsfCXq4tM+lPYpsg4IdYNdpuYpjiZG7VtTqYRh3CMhBttuRCkKFDFu53wfH1Z6vJRc7BBCn9pSSvKr9I9Xviim+1o2T2zmtzFReSO/Zi0/EJZdXiPohT4WfsOXSmtZ9D4D/B SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Dec 2017 03:48:28.7577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d47c138-a038-4c29-77a7-08d550015adf X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR07MB315 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes Compiling with Clang 6 shows these errors: /home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:26610:43: error: result of comparison of constant 4294967296 with expression of type 'typename std::underlying_type::type' (a ka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (to_underlying (per_cu.sect_off) >= (static_cast (1) << 32)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:26618:43: error: result of comparison of constant 4294967296 with expression of type 'typename std::underlying_type::type' (a ka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (to_underlying (per_cu.sect_off) >= (static_cast (1) << 32)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The code in question checks if there is any offset exceeding 32 bits, and therefore if we need to use the 64-bit DWARF format when writing the .debug_names section. The type we use currently to represent section offsets is an unsigned int (32-bits), which means a value of this type will never exceed 32 bits, hence the errors above. There are many signs that we want to support 64-bits DWARF (although I haven't tested), such as: - We correctly read initial length fields (read_initial_length) - We take that into account when reading offsets (read_offset_1) - The check_dwarf64_offsets function However, I don't see how it can work if sect_offset is a 32-bits type. Every time we record a section offset, we risk truncating the value. And if a file uses the 64-bit DWARF format, it's most likely because there are such offset values that overflow 32 bits. Because of this, I think the way forward is to change sect_offset to be a uint64_t. It will be able to represent any offset, regardless of the bitness of the DWARF info. This patch was regtested on the buildbot. gdb/ChangeLog: * gdbtypes.h (sect_offset): Change type to uint64_t. (sect_offset_str): New function. * dwarf2read.c (create_addrmap_from_aranges): Use sect_offset_str. (error_check_comp_unit_head): Likewise. (create_debug_type_hash_table): Likewise. (read_cutu_die_from_dwo): Likewise. (init_cutu_and_read_dies): Likewise. (init_cutu_and_read_dies_no_follow): Likewise. (process_psymtab_comp_unit_reader): Likewise. (partial_die_parent_scope): Likewise. (peek_die_abbrev): Likewise. (process_queue): Likewise. (dwarf2_physname): Likewise. (read_namespace_alias): Likewise. (read_import_statement): Likewise. (create_dwo_cu_reader): Likewise. (create_cus_hash_table): Likewise. (lookup_dwo_cutu): Likewise. (inherit_abstract_dies): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_add_member_fn): Likewise. (read_common_block): Likewise. (read_module_type): Likewise. (read_typedef): Likewise. (read_subrange_type): Likewise. (load_partial_dies): Likewise. (read_partial_die): Likewise. (find_partial_die): Likewise. (read_str_index): Likewise. (dwarf2_string_attr): Likewise. (build_error_marker_type): Likewise. (lookup_die_type): Likewise. (dump_die_shallow): Likewise. (follow_die_ref): Likewise. (dwarf2_fetch_die_loc_sect_off): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (follow_die_sig): Likewise. (get_signatured_type): Likewise. (get_DW_AT_signature_type): Likewise. (dwarf2_find_containing_comp_unit): Likewise. (set_die_type): Likewise. --- gdb/dwarf2read.c | 332 ++++++++++++++++++++++++++++--------------------------- gdb/gdbtypes.h | 10 +- 2 files changed, 177 insertions(+), 165 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index fcd5e99..d3e641b 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3440,8 +3440,8 @@ create_addrmap_from_aranges (struct objfile *objfile, if (!insertpair.second) { warning (_("Section .debug_aranges in %s has duplicate " - "debug_info_offset %u, ignoring .debug_aranges."), - objfile_name (objfile), to_underlying (per_cu->sect_off)); + "debug_info_offset %s, ignoring .debug_aranges."), + objfile_name (objfile), sect_offset_str (per_cu->sect_off)); return; } } @@ -6719,10 +6719,10 @@ error_check_comp_unit_head (struct comp_unit_head *header, if (to_underlying (header->abbrev_sect_off) >= dwarf2_section_size (dwarf2_per_objfile->objfile, abbrev_section)) - error (_("Dwarf Error: bad offset (0x%x) in compilation unit header " - "(offset 0x%x + 6) [in module %s]"), - to_underlying (header->abbrev_sect_off), - to_underlying (header->sect_off), + error (_("Dwarf Error: bad offset (%s) in compilation unit header " + "(offset %s + 6) [in module %s]"), + sect_offset_str (header->abbrev_sect_off), + sect_offset_str (header->sect_off), filename); /* Cast to ULONGEST to use 64-bit arithmetic when possible to @@ -6730,8 +6730,8 @@ error_check_comp_unit_head (struct comp_unit_head *header, if (((ULONGEST) header->sect_off + get_cu_length (header)) > section->size) error (_("Dwarf Error: bad length (0x%x) in compilation unit header " - "(offset 0x%x + 0) [in module %s]"), - header->length, to_underlying (header->sect_off), + "(offset %s + 0) [in module %s]"), + header->length, sect_offset_str (header->sect_off), filename); } @@ -7023,16 +7023,16 @@ create_debug_type_hash_table (struct dwo_file *dwo_file, } complaint (&symfile_complaints, - _("debug type entry at offset 0x%x is duplicate to" - " the entry at offset 0x%x, signature %s"), - to_underlying (sect_off), to_underlying (dup_sect_off), + _("debug type entry at offset %s is duplicate to" + " the entry at offset %s, signature %s"), + sect_offset_str (sect_off), sect_offset_str (dup_sect_off), hex_string (header.signature)); } *slot = dwo_file ? (void *) dwo_tu : (void *) sig_type; if (dwarf_read_debug > 1) - fprintf_unfiltered (gdb_stdlog, " offset 0x%x, signature %s\n", - to_underlying (sect_off), + fprintf_unfiltered (gdb_stdlog, " offset %s, signature %s\n", + sect_offset_str (sect_off), hex_string (header.signature)); info_ptr += length; @@ -7468,10 +7468,10 @@ read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu, if (sig_type->signature != cu->header.signature) { error (_("Dwarf Error: signature mismatch %s vs %s while reading" - " TU at offset 0x%x [in module %s]"), + " TU at offset %s [in module %s]"), hex_string (sig_type->signature), hex_string (cu->header.signature), - to_underlying (dwo_unit->sect_off), + sect_offset_str (dwo_unit->sect_off), bfd_get_filename (abfd)); } gdb_assert (dwo_unit->sect_off == cu->header.sect_off); @@ -7747,9 +7747,9 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu, int rereading_dwo_cu = 0; if (dwarf_die_debug) - fprintf_unfiltered (gdb_stdlog, "Reading %s unit at offset 0x%x\n", + fprintf_unfiltered (gdb_stdlog, "Reading %s unit at offset %s\n", this_cu->is_debug_types ? "type" : "comp", - to_underlying (this_cu->sect_off)); + sect_offset_str (this_cu->sect_off)); if (use_existing_cu) gdb_assert (keep); @@ -7890,8 +7890,9 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu, { complaint (&symfile_complaints, _("compilation unit with DW_AT_GNU_dwo_name" - " has children (offset 0x%x) [in module %s]"), - to_underlying (this_cu->sect_off), bfd_get_filename (abfd)); + " has children (offset %s) [in module %s]"), + sect_offset_str (this_cu->sect_off), + bfd_get_filename (abfd)); } dwo_unit = lookup_dwo_unit (this_cu, comp_unit_die); if (dwo_unit != NULL) @@ -7979,9 +7980,9 @@ init_cutu_and_read_dies_no_follow (struct dwarf2_per_cu_data *this_cu, int has_children; if (dwarf_die_debug) - fprintf_unfiltered (gdb_stdlog, "Reading %s unit at offset 0x%x\n", + fprintf_unfiltered (gdb_stdlog, "Reading %s unit at offset %s\n", this_cu->is_debug_types ? "type" : "comp", - to_underlying (this_cu->sect_off)); + sect_offset_str (this_cu->sect_off)); gdb_assert (this_cu->cu == NULL); @@ -8353,10 +8354,10 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, struct gdbarch *gdbarch = get_objfile_arch (objfile); fprintf_unfiltered (gdb_stdlog, - "Psymtab for %s unit @0x%x: %s - %s" + "Psymtab for %s unit @%s: %s - %s" ", %d global, %d static syms\n", per_cu->is_debug_types ? "type" : "comp", - to_underlying (per_cu->sect_off), + sect_offset_str (per_cu->sect_off), paddress (gdbarch, pst->textlow), paddress (gdbarch, pst->texthigh), pst->n_global_syms, pst->n_static_syms); @@ -9128,8 +9129,8 @@ partial_die_parent_scope (struct partial_die_info *pdi, function-local names? For partial symbols, we should probably be ignoring them. */ complaint (&symfile_complaints, - _("unhandled containing DIE tag %d for DIE at %d"), - parent->tag, to_underlying (pdi->sect_off)); + _("unhandled containing DIE tag %d for DIE at %s"), + parent->tag, sect_offset_str (pdi->sect_off)); parent->scope = grandparent_scope; } @@ -9521,9 +9522,9 @@ peek_die_abbrev (const gdb_byte *info_ptr, unsigned int *bytes_read, if (!abbrev) { error (_("Dwarf Error: Could not find abbrev number %d in %s" - " at offset 0x%x [in module %s]"), + " at offset %s [in module %s]"), abbrev_number, cu->per_cu->is_debug_types ? "TU" : "CU", - to_underlying (cu->header.sect_off), bfd_get_filename (abfd)); + sect_offset_str (cu->header.sect_off), bfd_get_filename (abfd)); } return abbrev; @@ -9866,17 +9867,17 @@ process_queue (void) struct signatured_type *sig_type = (struct signatured_type *) per_cu; - sprintf (buf, "TU %s at offset 0x%x", + sprintf (buf, "TU %s at offset %s", hex_string (sig_type->signature), - to_underlying (per_cu->sect_off)); + sect_offset_str (per_cu->sect_off)); /* There can be 100s of TUs. Only print them in verbose mode. */ debug_print_threshold = 2; } else { - sprintf (buf, "CU at offset 0x%x", - to_underlying (per_cu->sect_off)); + sprintf (buf, "CU at offset %s", + sect_offset_str (per_cu->sect_off)); debug_print_threshold = 1; } @@ -11135,8 +11136,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("Computed physname <%s> does not match demangled <%s> " - "(from linkage <%s>) - DIE at 0x%x [in module %s]"), - physname, canon, mangled, to_underlying (die->sect_off), + "(from linkage <%s>) - DIE at %s [in module %s]"), + physname, canon, mangled, sect_offset_str (die->sect_off), objfile_name (objfile)); /* Prefer DW_AT_linkage_name (in the CANON form) - when it @@ -11198,8 +11199,8 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu) if (num == MAX_NESTED_IMPORTED_DECLARATIONS) { complaint (&symfile_complaints, - _("DIE at 0x%x has too many recursively imported " - "declarations"), to_underlying (d->sect_off)); + _("DIE at %s has too many recursively imported " + "declarations"), sect_offset_str (d->sect_off)); return 0; } @@ -11342,8 +11343,9 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) { complaint (&symfile_complaints, _("child DW_TAG_imported_declaration expected " - "- DIE at 0x%x [in module %s]"), - to_underlying (child_die->sect_off), objfile_name (objfile)); + "- DIE at %s [in module %s]"), + sect_offset_str (child_die->sect_off), + objfile_name (objfile)); continue; } @@ -11363,8 +11365,9 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) { complaint (&symfile_complaints, _("child DW_TAG_imported_declaration has unknown " - "imported name - DIE at 0x%x [in module %s]"), - to_underlying (child_die->sect_off), objfile_name (objfile)); + "imported name - DIE at %s [in module %s]"), + sect_offset_str (child_die->sect_off), + objfile_name (objfile)); continue; } @@ -11901,9 +11904,9 @@ create_dwo_cu_reader (const struct die_reader_specs *reader, if (attr == NULL) { complaint (&symfile_complaints, - _("Dwarf Error: debug entry at offset 0x%x is missing" + _("Dwarf Error: debug entry at offset %s is missing" " its dwo_id [in module %s]"), - to_underlying (sect_off), dwo_file->dwo_name); + sect_offset_str (sect_off), dwo_file->dwo_name); return; } @@ -11914,8 +11917,8 @@ create_dwo_cu_reader (const struct die_reader_specs *reader, dwo_unit->length = cu->per_cu->length; if (dwarf_read_debug) - fprintf_unfiltered (gdb_stdlog, " offset 0x%x, dwo_id %s\n", - to_underlying (sect_off), + fprintf_unfiltered (gdb_stdlog, " offset %s, dwo_id %s\n", + sect_offset_str (sect_off), hex_string (dwo_unit->signature)); } @@ -11981,9 +11984,9 @@ create_cus_hash_table (struct dwo_file &dwo_file, dwarf2_section_info §ion, sect_offset dup_sect_off = dup_cu->sect_off; complaint (&symfile_complaints, - _("debug cu entry at offset 0x%x is duplicate to" - " the entry at offset 0x%x, signature %s"), - to_underlying (sect_off), to_underlying (dup_sect_off), + _("debug cu entry at offset %s is duplicate to" + " the entry at offset %s, signature %s"), + sect_offset_str (sect_off), sect_offset_str (dup_sect_off), hex_string (dwo_unit->signature)); } *slot = (void *)dwo_unit; @@ -13398,12 +13401,12 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit, dwp_text = string_printf (" [in DWP file %s]", lbasename (dwp_file->name)); - warning (_("Could not find DWO %s %s(%s)%s referenced by %s at offset 0x%x" + warning (_("Could not find DWO %s %s(%s)%s referenced by %s at offset %s" " [in module %s]"), kind, dwo_name, hex_string (signature), dwp_text.c_str (), this_unit->is_debug_types ? "TU" : "CU", - to_underlying (this_unit->sect_off), objfile_name (objfile)); + sect_offset_str (this_unit->sect_off), objfile_name (objfile)); } return NULL; } @@ -13563,9 +13566,9 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) && !(die->tag == DW_TAG_inlined_subroutine && origin_die->tag == DW_TAG_subprogram)) complaint (&symfile_complaints, - _("DIE 0x%x and its abstract origin 0x%x have different tags"), - to_underlying (die->sect_off), - to_underlying (origin_die->sect_off)); + _("DIE %s and its abstract origin %s have different tags"), + sect_offset_str (die->sect_off), + sect_offset_str (origin_die->sect_off)); std::vector offsets; @@ -13610,16 +13613,16 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) && !(child_die->tag == DW_TAG_inlined_subroutine && child_origin_die->tag == DW_TAG_subprogram)) complaint (&symfile_complaints, - _("Child DIE 0x%x and its abstract origin 0x%x have " + _("Child DIE %s and its abstract origin %s have " "different tags"), - to_underlying (child_die->sect_off), - to_underlying (child_origin_die->sect_off)); + sect_offset_str (child_die->sect_off), + sect_offset_str (child_origin_die->sect_off)); if (child_origin_die->parent != origin_die) complaint (&symfile_complaints, - _("Child DIE 0x%x and its abstract origin 0x%x have " + _("Child DIE %s and its abstract origin %s have " "different parents"), - to_underlying (child_die->sect_off), - to_underlying (child_origin_die->sect_off)); + sect_offset_str (child_die->sect_off), + sect_offset_str (child_origin_die->sect_off)); else offsets.push_back (child_origin_die->sect_off); } @@ -13629,9 +13632,9 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) for (offsetp = offsets.data () + 1; offsetp < offsets_end; offsetp++) if (offsetp[-1] == *offsetp) complaint (&symfile_complaints, - _("Multiple children of DIE 0x%x refer " - "to DIE 0x%x as their abstract origin"), - to_underlying (die->sect_off), to_underlying (*offsetp)); + _("Multiple children of DIE %s refer " + "to DIE %s as their abstract origin"), + sect_offset_str (die->sect_off), sect_offset_str (*offsetp)); offsetp = offsets.data (); origin_child_die = origin_die->child; @@ -13696,8 +13699,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) if (name == NULL) { complaint (&symfile_complaints, - _("missing name for subprogram DIE at %d"), - to_underlying (die->sect_off)); + _("missing name for subprogram DIE at %s"), + sect_offset_str (die->sect_off)); return; } @@ -13709,8 +13712,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) if (!attr || !DW_UNSND (attr)) complaint (&symfile_complaints, _("cannot get low and high bounds " - "for subprogram DIE at %d"), - to_underlying (die->sect_off)); + "for subprogram DIE at %s"), + sect_offset_str (die->sect_off)); return; } @@ -13943,8 +13946,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) { complaint (&symfile_complaints, _("missing DW_AT_call_return_pc for DW_TAG_call_site " - "DIE 0x%x [in module %s]"), - to_underlying (die->sect_off), objfile_name (objfile)); + "DIE %s [in module %s]"), + sect_offset_str (die->sect_off), objfile_name (objfile)); return; } pc = attr_value_as_address (attr) + baseaddr; @@ -13960,8 +13963,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) { complaint (&symfile_complaints, _("Duplicate PC %s for DW_TAG_call_site " - "DIE 0x%x [in module %s]"), - paddress (gdbarch, pc), to_underlying (die->sect_off), + "DIE %s [in module %s]"), + paddress (gdbarch, pc), sect_offset_str (die->sect_off), objfile_name (objfile)); return; } @@ -13977,8 +13980,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) { complaint (&symfile_complaints, _("Tag %d is not DW_TAG_call_site_parameter in " - "DW_TAG_call_site child DIE 0x%x [in module %s]"), - child_die->tag, to_underlying (child_die->sect_off), + "DW_TAG_call_site child DIE %s [in module %s]"), + child_die->tag, sect_offset_str (child_die->sect_off), objfile_name (objfile)); continue; } @@ -14040,8 +14043,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) else complaint (&symfile_complaints, _("Cannot find function owning DW_TAG_call_site " - "DIE 0x%x [in module %s]"), - to_underlying (die->sect_off), objfile_name (objfile)); + "DIE %s [in module %s]"), + sect_offset_str (die->sect_off), objfile_name (objfile)); } } @@ -14087,8 +14090,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) if (target_physname == NULL) complaint (&symfile_complaints, _("DW_AT_call_target target DIE has invalid " - "physname, for referencing DIE 0x%x [in module %s]"), - to_underlying (die->sect_off), objfile_name (objfile)); + "physname, for referencing DIE %s [in module %s]"), + sect_offset_str (die->sect_off), objfile_name (objfile)); else SET_FIELD_PHYSNAME (call_site->target, target_physname); } @@ -14101,8 +14104,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) <= PC_BOUNDS_INVALID) complaint (&symfile_complaints, _("DW_AT_call_target target DIE has invalid " - "low pc, for referencing DIE 0x%x [in module %s]"), - to_underlying (die->sect_off), objfile_name (objfile)); + "low pc, for referencing DIE %s [in module %s]"), + sect_offset_str (die->sect_off), objfile_name (objfile)); else { lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr); @@ -14113,8 +14116,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) else complaint (&symfile_complaints, _("DW_TAG_call_site DW_AT_call_target is neither " - "block nor reference, for DIE 0x%x [in module %s]"), - to_underlying (die->sect_off), objfile_name (objfile)); + "block nor reference, for DIE %s [in module %s]"), + sect_offset_str (die->sect_off), objfile_name (objfile)); call_site->per_cu = cu->per_cu; @@ -14160,8 +14163,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) therefore cannot be even moved to DW_TAG_partial_unit. */ complaint (&symfile_complaints, _("DW_AT_call_parameter offset is not in CU for " - "DW_TAG_call_site child DIE 0x%x [in module %s]"), - to_underlying (child_die->sect_off), + "DW_TAG_call_site child DIE %s [in module %s]"), + sect_offset_str (child_die->sect_off), objfile_name (objfile)); continue; } @@ -14172,8 +14175,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) { complaint (&symfile_complaints, _("No DW_FORM_block* DW_AT_location for " - "DW_TAG_call_site child DIE 0x%x [in module %s]"), - to_underlying (child_die->sect_off), objfile_name (objfile)); + "DW_TAG_call_site child DIE %s [in module %s]"), + sect_offset_str (child_die->sect_off), objfile_name (objfile)); continue; } else @@ -14191,9 +14194,9 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("Only single DW_OP_reg or DW_OP_fbreg is supported " "for DW_FORM_block* DW_AT_location is supported for " - "DW_TAG_call_site child DIE 0x%x " + "DW_TAG_call_site child DIE %s " "[in module %s]"), - to_underlying (child_die->sect_off), + sect_offset_str (child_die->sect_off), objfile_name (objfile)); continue; } @@ -14206,8 +14209,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) { complaint (&symfile_complaints, _("No DW_FORM_block* DW_AT_call_value for " - "DW_TAG_call_site child DIE 0x%x [in module %s]"), - to_underlying (child_die->sect_off), + "DW_TAG_call_site child DIE %s [in module %s]"), + sect_offset_str (child_die->sect_off), objfile_name (objfile)); continue; } @@ -14227,8 +14230,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) if (!attr_form_is_block (attr)) complaint (&symfile_complaints, _("No DW_FORM_block* DW_AT_call_data_value for " - "DW_TAG_call_site child DIE 0x%x [in module %s]"), - to_underlying (child_die->sect_off), + "DW_TAG_call_site child DIE %s [in module %s]"), + sect_offset_str (child_die->sect_off), objfile_name (objfile)); else { @@ -15567,8 +15570,8 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, { complaint (&symfile_complaints, _("cannot determine context for virtual member " - "function \"%s\" (offset %d)"), - fieldname, to_underlying (die->sect_off)); + "function \"%s\" (offset %s)"), + fieldname, sect_offset_str (die->sect_off)); } else { @@ -15594,9 +15597,9 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, { /* GCC does this, as of 2008-08-25; PR debug/37237. */ complaint (&symfile_complaints, - _("Member function \"%s\" (offset %d) is virtual " + _("Member function \"%s\" (offset %s) is virtual " "but the vtable offset is not specified"), - fieldname, to_underlying (die->sect_off)); + fieldname, sect_offset_str (die->sect_off)); ALLOCATE_CPLUS_STRUCT_TYPE (type); TYPE_CPLUS_DYNAMIC (type) = 1; } @@ -16622,8 +16625,8 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("Variable in common block has " "DW_AT_data_member_location " - "- DIE at 0x%x [in module %s]"), - to_underlying (child_die->sect_off), + "- DIE at %s [in module %s]"), + sect_offset_str (child_die->sect_off), objfile_name (cu->objfile)); if (attr_form_is_section_offset (member_loc)) @@ -16743,8 +16746,8 @@ read_module_type (struct die_info *die, struct dwarf2_cu *cu) module_name = dwarf2_name (die, cu); if (!module_name) complaint (&symfile_complaints, - _("DW_TAG_module has no name, offset 0x%x"), - to_underlying (die->sect_off)); + _("DW_TAG_module has no name, offset %s"), + sect_offset_str (die->sect_off)); type = init_type (objfile, TYPE_CODE_MODULE, 0, module_name); /* determine_prefix uses TYPE_TAG_NAME. */ @@ -17286,8 +17289,8 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu) spec and cause infinite loops in GDB. */ complaint (&symfile_complaints, _("Self-referential DW_TAG_typedef " - "- DIE at 0x%x [in module %s]"), - to_underlying (die->sect_off), objfile_name (objfile)); + "- DIE at %s [in module %s]"), + sect_offset_str (die->sect_off), objfile_name (objfile)); TYPE_TARGET_TYPE (this_type) = NULL; } return this_type; @@ -17592,8 +17595,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) attr_to_dynamic_prop (attr, die, cu, &low); else if (!low_default_is_valid) complaint (&symfile_complaints, _("Missing DW_AT_lower_bound " - "- DIE at 0x%x [in module %s]"), - to_underlying (die->sect_off), objfile_name (cu->objfile)); + "- DIE at %s [in module %s]"), + sect_offset_str (die->sect_off), objfile_name (cu->objfile)); attr = dwarf2_attr (die, DW_AT_upper_bound, cu); if (!attr_to_dynamic_prop (attr, die, cu, &high)) @@ -18282,8 +18285,8 @@ load_partial_dies (const struct die_reader_specs *reader, if (part_die->tag == DW_TAG_typedef && part_die->has_children) complaint (&symfile_complaints, _("DW_TAG_typedef has childen - GCC PR debug/47510 bug " - "- DIE at 0x%x [in module %s]"), - to_underlying (part_die->sect_off), objfile_name (objfile)); + "- DIE at %s [in module %s]"), + sect_offset_str (part_die->sect_off), objfile_name (objfile)); /* If we're at the second level, and we're an enumerator, and our parent has no specification (meaning possibly lives in a @@ -18603,9 +18606,10 @@ read_partial_die (const struct die_reader_specs *reader, complaint (&symfile_complaints, _("DW_AT_low_pc %s is zero " - "for DIE at 0x%x [in module %s]"), + "for DIE at %s [in module %s]"), paddress (gdbarch, part_die->lowpc), - to_underlying (part_die->sect_off), objfile_name (objfile)); + sect_offset_str (part_die->sect_off), + objfile_name (objfile)); } /* dwarf2_get_pc_bounds has also the strict low < high requirement. */ else if (part_die->lowpc >= part_die->highpc) @@ -18614,10 +18618,10 @@ read_partial_die (const struct die_reader_specs *reader, complaint (&symfile_complaints, _("DW_AT_low_pc %s is not < DW_AT_high_pc %s " - "for DIE at 0x%x [in module %s]"), + "for DIE at %s [in module %s]"), paddress (gdbarch, part_die->lowpc), paddress (gdbarch, part_die->highpc), - to_underlying (part_die->sect_off), + sect_offset_str (part_die->sect_off), objfile_name (objfile)); } else @@ -18670,9 +18674,9 @@ find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu) /* TUs don't reference other CUs/TUs (except via type signatures). */ if (cu->per_cu->is_debug_types) { - error (_("Dwarf Error: Type Unit at offset 0x%x contains" - " external reference to offset 0x%x [in module %s].\n"), - to_underlying (cu->header.sect_off), to_underlying (sect_off), + error (_("Dwarf Error: Type Unit at offset %s contains" + " external reference to offset %s [in module %s].\n"), + sect_offset_str (cu->header.sect_off), sect_offset_str (sect_off), bfd_get_filename (objfile->obfd)); } per_cu = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz, @@ -18705,9 +18709,9 @@ find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu) if (pd == NULL) internal_error (__FILE__, __LINE__, - _("could not find partial DIE 0x%x " + _("could not find partial DIE %s " "in cache [from module %s]\n"), - to_underlying (sect_off), bfd_get_filename (objfile->obfd)); + sect_offset_str (sect_off), bfd_get_filename (objfile->obfd)); return pd; } @@ -19661,16 +19665,16 @@ read_str_index (const struct die_reader_specs *reader, ULONGEST str_index) dwarf2_read_section (objfile, str_offsets_section); if (str_section->buffer == NULL) error (_("%s used without .debug_str.dwo section" - " in CU at offset 0x%x [in module %s]"), - form_name, to_underlying (cu->header.sect_off), objf_name); + " in CU at offset %s [in module %s]"), + form_name, sect_offset_str (cu->header.sect_off), objf_name); if (str_offsets_section->buffer == NULL) error (_("%s used without .debug_str_offsets.dwo section" - " in CU at offset 0x%x [in module %s]"), - form_name, to_underlying (cu->header.sect_off), objf_name); + " in CU at offset %s [in module %s]"), + form_name, sect_offset_str (cu->header.sect_off), objf_name); if (str_index * cu->header.offset_size >= str_offsets_section->size) error (_("%s pointing outside of .debug_str_offsets.dwo" - " section in CU at offset 0x%x [in module %s]"), - form_name, to_underlying (cu->header.sect_off), objf_name); + " section in CU at offset %s [in module %s]"), + form_name, sect_offset_str (cu->header.sect_off), objf_name); info_ptr = (str_offsets_section->buffer + str_index * cu->header.offset_size); if (cu->header.offset_size == 4) @@ -19679,8 +19683,8 @@ read_str_index (const struct die_reader_specs *reader, ULONGEST str_index) str_offset = bfd_get_64 (abfd, info_ptr); if (str_offset >= str_section->size) error (_("Offset from %s pointing outside of" - " .debug_str.dwo section in CU at offset 0x%x [in module %s]"), - form_name, to_underlying (cu->header.sect_off), objf_name); + " .debug_str.dwo section in CU at offset %s [in module %s]"), + form_name, sect_offset_str (cu->header.sect_off), objf_name); return (const char *) (str_section->buffer + str_offset); } @@ -19827,8 +19831,8 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c else complaint (&symfile_complaints, _("string type expected for attribute %s for " - "DIE at 0x%x in module %s"), - dwarf_attr_name (name), to_underlying (die->sect_off), + "DIE at %s in module %s"), + dwarf_attr_name (name), sect_offset_str (die->sect_off), objfile_name (cu->objfile)); } @@ -21815,10 +21819,10 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die) struct objfile *objfile = dwarf2_per_objfile->objfile; char *message, *saved; - message = xstrprintf (_(""), + message = xstrprintf (_(""), objfile_name (objfile), - to_underlying (cu->header.sect_off), - to_underlying (die->sect_off)); + sect_offset_str (cu->header.sect_off), + sect_offset_str (die->sect_off)); saved = (char *) obstack_copy0 (&objfile->objfile_obstack, message, strlen (message)); xfree (message); @@ -21868,8 +21872,8 @@ lookup_die_type (struct die_info *die, const struct attribute *attr, { complaint (&symfile_complaints, _("Dwarf Error: Bad type attribute %s in DIE" - " at 0x%x [in module %s]"), - dwarf_attr_name (attr->name), to_underlying (die->sect_off), + " at %s [in module %s]"), + dwarf_attr_name (attr->name), sect_offset_str (die->sect_off), objfile_name (objfile)); return build_error_marker_type (cu, die); } @@ -22554,15 +22558,15 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) unsigned int i; print_spaces (indent, f); - fprintf_unfiltered (f, "Die: %s (abbrev %d, offset 0x%x)\n", + fprintf_unfiltered (f, "Die: %s (abbrev %d, offset %s)\n", dwarf_tag_name (die->tag), die->abbrev, - to_underlying (die->sect_off)); + sect_offset_str (die->sect_off)); if (die->parent != NULL) { print_spaces (indent, f); - fprintf_unfiltered (f, " parent at offset: 0x%x\n", - to_underlying (die->parent->sect_off)); + fprintf_unfiltered (f, " parent at offset: %s\n", + sect_offset_str (die->parent->sect_off)); } print_spaces (indent, f); @@ -22864,9 +22868,9 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr, || cu->per_cu->is_dwz), ref_cu); if (!die) - error (_("Dwarf Error: Cannot find DIE at 0x%x referenced from DIE " - "at 0x%x [in module %s]"), - to_underlying (sect_off), to_underlying (src_die->sect_off), + error (_("Dwarf Error: Cannot find DIE at %s referenced from DIE " + "at %s [in module %s]"), + sect_offset_str (sect_off), sect_offset_str (src_die->sect_off), objfile_name (cu->objfile)); return die; @@ -22896,14 +22900,14 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, { /* We shouldn't get here for a dummy CU, but don't crash on the user. Instead just throw an error, not much else we can do. */ - error (_("Dwarf Error: Dummy CU at 0x%x referenced in module %s"), - to_underlying (sect_off), objfile_name (per_cu->objfile)); + error (_("Dwarf Error: Dummy CU at %s referenced in module %s"), + sect_offset_str (sect_off), objfile_name (per_cu->objfile)); } die = follow_die_offset (sect_off, per_cu->is_dwz, &cu); if (!die) - error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"), - to_underlying (sect_off), objfile_name (per_cu->objfile)); + error (_("Dwarf Error: Cannot find DIE at %s referenced in module %s"), + sect_offset_str (sect_off), objfile_name (per_cu->objfile)); attr = dwarf2_attr (die, DW_AT_location, cu); if (!attr) @@ -22929,9 +22933,9 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, else { if (!attr_form_is_block (attr)) - error (_("Dwarf Error: DIE at 0x%x referenced in module %s " + error (_("Dwarf Error: DIE at %s referenced in module %s " "is neither DW_FORM_block* nor DW_FORM_exprloc"), - to_underlying (sect_off), objfile_name (per_cu->objfile)); + sect_offset_str (sect_off), objfile_name (per_cu->objfile)); retval.data = DW_BLOCK (attr)->data; retval.size = DW_BLOCK (attr)->size; @@ -23004,14 +23008,14 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off, { /* We shouldn't get here for a dummy CU, but don't crash on the user. Instead just throw an error, not much else we can do. */ - error (_("Dwarf Error: Dummy CU at 0x%x referenced in module %s"), - to_underlying (sect_off), objfile_name (per_cu->objfile)); + error (_("Dwarf Error: Dummy CU at %s referenced in module %s"), + sect_offset_str (sect_off), objfile_name (per_cu->objfile)); } die = follow_die_offset (sect_off, per_cu->is_dwz, &cu); if (!die) - error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"), - to_underlying (sect_off), objfile_name (per_cu->objfile)); + error (_("Dwarf Error: Cannot find DIE at %s referenced in module %s"), + sect_offset_str (sect_off), objfile_name (per_cu->objfile)); attr = dwarf2_attr (die, DW_AT_const_value, cu); @@ -23217,8 +23221,8 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr, if (sig_type == NULL) { error (_("Dwarf Error: Cannot find signatured DIE %s referenced" - " from DIE at 0x%x [in module %s]"), - hex_string (signature), to_underlying (src_die->sect_off), + " from DIE at %s [in module %s]"), + hex_string (signature), sect_offset_str (src_die->sect_off), objfile_name ((*ref_cu)->objfile)); } @@ -23227,8 +23231,8 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr, { dump_die_for_error (src_die); error (_("Dwarf Error: Problem reading signatured DIE %s referenced" - " from DIE at 0x%x [in module %s]"), - hex_string (signature), to_underlying (src_die->sect_off), + " from DIE at %s [in module %s]"), + hex_string (signature), sect_offset_str (src_die->sect_off), objfile_name ((*ref_cu)->objfile)); } @@ -23254,8 +23258,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature, { complaint (&symfile_complaints, _("Dwarf Error: Cannot find signatured DIE %s referenced" - " from DIE at 0x%x [in module %s]"), - hex_string (signature), to_underlying (die->sect_off), + " from DIE at %s [in module %s]"), + hex_string (signature), sect_offset_str (die->sect_off), objfile_name (dwarf2_per_objfile->objfile)); return build_error_marker_type (cu, die); } @@ -23276,8 +23280,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature, { complaint (&symfile_complaints, _("Dwarf Error: Cannot build signatured type %s" - " referenced from DIE at 0x%x [in module %s]"), - hex_string (signature), to_underlying (die->sect_off), + " referenced from DIE at %s [in module %s]"), + hex_string (signature), sect_offset_str (die->sect_off), objfile_name (dwarf2_per_objfile->objfile)); type = build_error_marker_type (cu, die); } @@ -23286,8 +23290,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature, { complaint (&symfile_complaints, _("Dwarf Error: Problem reading signatured DIE %s referenced" - " from DIE at 0x%x [in module %s]"), - hex_string (signature), to_underlying (die->sect_off), + " from DIE at %s [in module %s]"), + hex_string (signature), sect_offset_str (die->sect_off), objfile_name (dwarf2_per_objfile->objfile)); type = build_error_marker_type (cu, die); } @@ -23319,8 +23323,8 @@ get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr, { complaint (&symfile_complaints, _("Dwarf Error: DW_AT_signature has bad form %s in DIE" - " at 0x%x [in module %s]"), - dwarf_form_name (attr->form), to_underlying (die->sect_off), + " at %s [in module %s]"), + dwarf_form_name (attr->form), sect_offset_str (die->sect_off), objfile_name (dwarf2_per_objfile->objfile)); return build_error_marker_type (cu, die); } @@ -24922,8 +24926,8 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, { if (low == 0 || this_cu->is_dwz != offset_in_dwz) error (_("Dwarf Error: could not find partial DIE containing " - "offset 0x%x [in module %s]"), - to_underlying (sect_off), bfd_get_filename (objfile->obfd)); + "offset %s [in module %s]"), + sect_offset_str (sect_off), bfd_get_filename (objfile->obfd)); gdb_assert (dwarf2_per_objfile->all_comp_units[low-1]->sect_off <= sect_off); @@ -24934,7 +24938,7 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, this_cu = dwarf2_per_objfile->all_comp_units[low]; if (low == dwarf2_per_objfile->n_comp_units - 1 && sect_off >= this_cu->sect_off + this_cu->length) - error (_("invalid dwarf2 offset %u"), to_underlying (sect_off)); + error (_("invalid dwarf2 offset %s"), sect_offset_str (sect_off)); gdb_assert (sect_off < this_cu->sect_off + this_cu->length); return this_cu; } @@ -25198,9 +25202,9 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) else if (attr != NULL) { complaint (&symfile_complaints, - _("DW_AT_allocated has the wrong form (%s) at DIE 0x%x"), + _("DW_AT_allocated has the wrong form (%s) at DIE %s"), (attr != NULL ? dwarf_form_name (attr->form) : "n/a"), - to_underlying (die->sect_off)); + sect_offset_str (die->sect_off)); } /* Read DW_AT_associated and set in type. */ @@ -25213,9 +25217,9 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) else if (attr != NULL) { complaint (&symfile_complaints, - _("DW_AT_associated has the wrong form (%s) at DIE 0x%x"), + _("DW_AT_associated has the wrong form (%s) at DIE %s"), (attr != NULL ? dwarf_form_name (attr->form) : "n/a"), - to_underlying (die->sect_off)); + sect_offset_str (die->sect_off)); } /* Read DW_AT_data_location and set in type. */ @@ -25242,8 +25246,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) htab_find_slot (dwarf2_per_objfile->die_type_hash, &ofs, INSERT); if (*slot) complaint (&symfile_complaints, - _("A problem internal to GDB: DIE 0x%x has type already set"), - to_underlying (die->sect_off)); + _("A problem internal to GDB: DIE %s has type already set"), + sect_offset_str (die->sect_off)); *slot = XOBNEW (&objfile->objfile_obstack, struct dwarf2_per_cu_offset_and_type); **slot = ofs; diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 68ffaf8..8b35fc5 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -47,6 +47,8 @@ #include "hashtab.h" #include "common/offset-type.h" #include "common/enum-flags.h" +#include "common/underlying.h" +#include "common/print-utils.h" /* Forward declarations for prototypes. */ struct field; @@ -63,7 +65,13 @@ DEFINE_OFFSET_TYPE (cu_offset, unsigned int); /* * Offset relative to the start of its .debug_info or .debug_types section. */ -DEFINE_OFFSET_TYPE (sect_offset, unsigned int); +DEFINE_OFFSET_TYPE (sect_offset, uint64_t); + +static inline char * +sect_offset_str (sect_offset offset) +{ + return hex_string (to_underlying (offset)); +} /* Some macros for char-based bitfields. */