From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id omVNKjVb2Gac7B8AWB0awg (envelope-from ) for ; Wed, 04 Sep 2024 09:05:57 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=jetbrains.com header.i=@jetbrains.com header.a=rsa-sha256 header.s=googleapps header.b=J50rnVFH; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8B2991E353; Wed, 4 Sep 2024 09:05:57 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-11.8 required=5.0 tests=ARC_SIGNED,ARC_VALID, BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,URIBL_BLOCKED,URIBL_DBL_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 720A41E08F for ; Wed, 4 Sep 2024 09:05:56 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 005203858428 for ; Wed, 4 Sep 2024 13:05:56 +0000 (GMT) Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 5ABEC3858C98 for ; Wed, 4 Sep 2024 13:05:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5ABEC3858C98 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=jetbrains.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jetbrains.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5ABEC3858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725455137; cv=none; b=UqtmMUp+q8dEuI4ikiV4fWTn2FwhZMOfm6lchXLZ8iKmlVddgCc37ZWj6J1coChixo/2fyYrYHrTk+6rCt/XYfVLRavMIbaPdJro/AKMqL/hSwXRsJnBt52ObG9PEGwpDCgOM6+TgGuGJB6Q+57kyDs3KSoFa0QccC107h5vJQw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725455137; c=relaxed/simple; bh=5LFJEkmQffoXm+fwfCAmNHJ0H1Ddg8hcKY1WNsEUBpE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pV/Q9y5P9Y9NbOSyE6/CyZccB5fnW9VX+ZaRTBXBxkdtTAsFQb8b8AfrRgzBmmkMmtMb414e169up6B/hpPC2RR8tYvb9/k/h7IEwm6teoouikvAzv61RNpku529hZCzac+18NhhYHkgr9MzXgDAzZXNQOrYrtz8wReoQUVZlz0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a7a843bef98so688557066b.2 for ; Wed, 04 Sep 2024 06:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jetbrains.com; s=googleapps; t=1725455134; x=1726059934; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=l2h1VI8qE+aXYenN1MYK3WmDU8ueg5k/oZFtLFltAkk=; b=J50rnVFHzqk73jtk5D0PGIEWkWciR8vH0846s0SNyfX1HV5ukwWXnfY9oEH0D1Pj8A ULFNe4Q0q0SE+qnERe9sppsPKrmEcC/xAHwDISDH/5cdYEm+PT3Pxudia2WkdPj8fDH4 mvcUd6e3O83nBwTY9KnXjjb9jMzlzz1E55FA4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725455134; x=1726059934; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=l2h1VI8qE+aXYenN1MYK3WmDU8ueg5k/oZFtLFltAkk=; b=oXf+wXE95IdNchmhuvyi+/eIE8psOxVNLidggjhYOQauiBcS8m9+sOT5fLsh/07QI7 b2BNr1InvIGH0JUPiSB2Pqyv1oZuxUUst9YlrhXpjkiM1b9p/ux7nIDM7ZitQlTI9LXL uyXVrmo1QYV5De1SqeFgwrgjs84LpXv4YK4/fI8wn/ur4CkgoT7gR62OaF5rhBrhBKg8 Bx4zuswP+T6GHJ+IUEYeitX+XMG1li2EF3gdILnPRmXexP2aw9bbCVgvoz0Hih8bdhRJ Pry7hbtXK40080wRjzk5ZVkHR6snNAGS9puaoe3HHWT9eznvQWpygHgCJDVLBe9xPKM+ LFAQ== X-Gm-Message-State: AOJu0Yxg17LYbUoKxaQY8ywucP8cxd5Q2PgGlhACh2rDBTYLZOq4HIvW wLR/xfPETadzXkP7dNVl3GppZDZZPYHC3uhO/3OyUcwn/uBSoqhzsNHg4VVtJKg5FJoqFYatAMM 0hg== X-Google-Smtp-Source: AGHT+IHn3uhysI/5GLE09O3RPQCGuAclV9wqApW3w2ZsKLx5yFjK1B9oIW3FVfqi+G6TIpmWJUVE8A== X-Received: by 2002:a17:907:720e:b0:a8a:5ff9:bcd1 with SMTP id a640c23a62f3a-a8a5ff9bf36mr8952366b.21.1725455133052; Wed, 04 Sep 2024 06:05:33 -0700 (PDT) Received: from lubuntu2.labs.intellij.net (ad96e1c12.dsl.de.colt.net. [217.110.28.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891a3e9dsm804806166b.108.2024.09.04.06.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 06:05:32 -0700 (PDT) From: Dmitry Neverov To: gdb-patches@sourceware.org Cc: tom@tromey.com, brobecker@adacore.com, dmitry.neverov@jetbrains.com Subject: [PR 31727 for gdb-15-branch] Recognize -2 as a tombstone value in .debug_line Date: Wed, 4 Sep 2024 15:05:29 +0200 Message-ID: <20240904130529.3172-1-dmitry.neverov@jetbrains.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Commit a8caed5d7faa639a1e6769eba551d15d8ddd9510 handled the tombstone value -1 used by lld (https://reviews.llvm.org/D81784). The referenced lld commit also uses the tombstone value -2 for pre-DWARF-v5 (https://github.com/llvm/llvm-project/commit/e618ccbf431f6730edb6d1467a127c3a52fd57f7). If not handled, -2 breaks the pc step range calculation and triggers the assertion: gdb/infrun.c:2794: internal-error: resume_1: Assertion `pc_in_thread_step_range (pc, tp)' failed. This commit adds -2 tombstone value and handles it in the same way as -1. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31727 Cherry-picked from e814012b2b108743e21b7ef2799310a0f4e0a86d --- gdb/dwarf2/read.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4818da58acb..2bdb022c4e2 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -17914,8 +17914,8 @@ class lnp_state_machine we're processing the end of a sequence. */ void record_line (bool end_sequence); - /* Check ADDRESS is -1, or zero and less than UNRELOCATED_LOWPC, and if true - nop-out rest of the lines in this sequence. */ + /* Check ADDRESS is -1, -2, or zero and less than UNRELOCATED_LOWPC, and if + true nop-out rest of the lines in this sequence. */ void check_line_address (struct dwarf2_cu *cu, const gdb_byte *line_ptr, unrelocated_addr unrelocated_lowpc, @@ -18325,13 +18325,16 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu, unrelocated_addr unrelocated_lowpc, unrelocated_addr address) { - /* Linkers resolve a symbolic relocation referencing a GC'd function to 0 or - -1. If ADDRESS is 0, ignoring the opcode will err if the text section is + /* Linkers resolve a symbolic relocation referencing a GC'd function to 0, + -1 or -2 (-2 is used by certain lld versions, see + https://github.com/llvm/llvm-project/commit/e618ccbf431f6730edb6d1467a127c3a52fd57f7). + If ADDRESS is 0, ignoring the opcode will err if the text section is located at 0x0. In this case, additionally check that if ADDRESS < UNRELOCATED_LOWPC. */ if ((address == (unrelocated_addr) 0 && address < unrelocated_lowpc) - || address == (unrelocated_addr) -1) + || address == (unrelocated_addr) -1 + || address == (unrelocated_addr) -2) { /* This line table is for a function which has been GCd by the linker. Ignore it. PR gdb/12528 */ -- 2.45.1