From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by sourceware.org (Postfix) with ESMTPS id 629BC3858412 for ; Mon, 24 Apr 2023 16:22:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 629BC3858412 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-7606d44604aso422654139f.1 for ; Mon, 24 Apr 2023 09:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1682353345; x=1684945345; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VkSFcl3k1oRS8qJJLmDEoyFEFbZaFGZZhlJMoHhaK1M=; b=bk+I/f5Zb6EEbfrBc9qrtVDSJRJJ5X+3xlmLdR4I5OpiEcRHCeDCRM5DEMKMHmPbuG lZwEb4wBjqHvnJZXPvYCrL11dugF9kor6K8P024hlYwvBVAZtaTtNkep7StdFrJwSzoB U3H9Sey4xbU35yCFMw+9eRL1Ag2/2E2IwpBhdFfBF3v7jEVmz885jMxs37SFbu3HUUQe +2rsQ/cf8uFMRwArzqWcUO7t94inD9IOPecdcMDyH67hSv25DzgK8An8RFEoLw3+T2cX /V0cb8USsWuhGByILRWqiyZ6x/wUxJ3TdeedQ7JYQDooiQPunsNYlKhWT+QDARUuLy2g vRUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682353345; x=1684945345; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VkSFcl3k1oRS8qJJLmDEoyFEFbZaFGZZhlJMoHhaK1M=; b=X8ipJw1wPg9QHkI2qGFxF7xuduIy0T1JMVuBuuefobgqVTp8cyq2I/Ag2DGiJ3+jhz La2V6HhqxXTMCSvorDSiVv4EAIYf+9KKvnMukPWEBV34ZMakhjce3kPGe/Riz4KggOFN HDcdCjeq0KYCeolTIBUBkRuLk5f6dkkh8k4l6XghkJrfaMGit9WFbIJa198OKOEHKH0i v4iWru+KWk4eOhSCXza+KowgRjqgMHvzC+Qs8L+N5CMpFykdBaH18tdiBMccXiNWR0wl MOSzyQD4qdksAnW2zT8xJemvUF8l1zQ6v+mgqsH7qJhfOhVhXNGJJL6UgvrxFxtkcht7 VvkA== X-Gm-Message-State: AAQBX9fIS+bYyYEPH5D4AuZqMN/bnAitT8CyWI3UGEiRnztrePY4IBPY 9zQPmcf1GSQdolI9V2qWlIe1GNFlysqO9nS0mhPOfg== X-Google-Smtp-Source: AKy350Z5VDL7IvYBFcD2jnsBW7O1qJZoqanYQEpbg8u4nW/Wdl4fcLvZtr0tQiJrXdX/udz73f08tw== X-Received: by 2002:a05:6602:2004:b0:760:e373:f833 with SMTP id y4-20020a056602200400b00760e373f833mr5968797iod.8.1682353345728; Mon, 24 Apr 2023 09:22:25 -0700 (PDT) Received: from localhost.localdomain (71-211-191-82.hlrn.qwest.net. [71.211.191.82]) by smtp.gmail.com with ESMTPSA id cx27-20020a056638491b00b0040fa19472bcsm3444049jab.92.2023.04.24.09.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 09:22:25 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC 05/10] Use unrelocated_addr in dwarf_decode_lines Date: Mon, 24 Apr 2023 10:22:06 -0600 Message-Id: <20230424162211.682763-6-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230424162211.682763-1-tromey@adacore.com> References: <20230424162211.682763-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: This changes dwarf_decode_lines to accept an unrelocated_addr and fixes up the fallout. --- gdb/dwarf2/read.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 39e4f05b389..6b3018831d1 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -809,7 +809,7 @@ static line_header_up dwarf_decode_line_header (sect_offset sect_off, static void dwarf_decode_lines (struct line_header *, struct dwarf2_cu *, - CORE_ADDR, int decode_mapping); + unrelocated_addr, int decode_mapping); static void dwarf2_start_subfile (dwarf2_cu *cu, const file_entry &fe, const line_header &lh); @@ -7537,7 +7537,7 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu) static void handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, - const file_and_directory &fnd, CORE_ADDR lowpc, + const file_and_directory &fnd, unrelocated_addr lowpc, bool have_code) /* ARI: editCase function */ { dwarf2_per_objfile *per_objfile = cu->per_objfile; @@ -7666,7 +7666,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) /* Decode line number information if present. We do this before processing child DIEs, so that the line header table is available for DW_AT_decl_file. */ - handle_DW_AT_stmt_list (die, cu, fnd, lowpc, unrel_low != unrel_high); + handle_DW_AT_stmt_list (die, cu, fnd, unrel_low, unrel_low != unrel_high); /* Process all dies in compilation unit. */ if (die->child != NULL) @@ -18455,19 +18455,16 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu, static void dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, - CORE_ADDR lowpc) + unrelocated_addr lowpc) { const gdb_byte *line_ptr, *extended_end; const gdb_byte *line_end; unsigned int bytes_read, extended_len; unsigned char op_code, extended_op; - CORE_ADDR baseaddr; struct objfile *objfile = cu->per_objfile->objfile; bfd *abfd = objfile->obfd.get (); struct gdbarch *gdbarch = objfile->arch (); - baseaddr = objfile->text_section_offset (); - line_ptr = lh->statement_program_start; line_end = lh->statement_program_end; @@ -18525,9 +18522,8 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, = cu->header.read_address (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; - state_machine.check_line_address - (cu, line_ptr, (unrelocated_addr) (lowpc - baseaddr), - address); + state_machine.check_line_address (cu, line_ptr, lowpc, + address); state_machine.handle_set_address (address); } break; @@ -18684,7 +18680,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, static void dwarf_decode_lines (struct line_header *lh, struct dwarf2_cu *cu, - CORE_ADDR lowpc, int decode_mapping) + unrelocated_addr lowpc, int decode_mapping) { if (decode_mapping) dwarf_decode_lines_1 (lh, cu, lowpc); -- 2.39.1