From patchwork Mon Jan 22 13:31:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Farre X-Patchwork-Id: 84552 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93C2C3858295 for ; Mon, 22 Jan 2024 13:32:04 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 128E53858D20 for ; Mon, 22 Jan 2024 13:31:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 128E53858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 128E53858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::231 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930293; cv=none; b=nc5fNG2vyYaGhUEDtSSZkNc4cOS7W8+2tHuESMJWUPWn5xbda2k2pwR9vGdrqhGmuGIvrdaoocP07onH6RW9433u89eTLEwDW+NEx3DVCxVsKiSOfpSkvX/fthfSzONM14hdQ73fy6p/EbSw9VPzZAgnk+/P2oRnhSi+aRPu0qg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930293; c=relaxed/simple; bh=y3qHQzK+lQxBMStw7LkaxU69/moBJV+uNGcHNfvK//A=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HHlPVgOdPRAozWwmKq2oD0xuKP5KHtZRx9KgF1rySoeGTsW9O0KQZ+pk+q5i/KKf7KV2VNEu3hEd8wDMxRtNXiulsgJSkkMTzhpJo06yQ4QoVNF9u0CllDd4ynmPWB3nxEUPqm3qGVI2Oh7CuDEalPc4riiZgehxgZSbcQtfiX4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2cdeb80fdfdso33772881fa.2 for ; Mon, 22 Jan 2024 05:31:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705930288; x=1706535088; 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=hbpZ5WgGOuXuoHmJv+dMVZWFraOq/OBgW8bdAY+9aBQ=; b=VGNczo4vEMthVvTSbW5PHp8GlDp0U+Bx1suhs9HERoKILynRm89cGfssDHviYscxCD OaIEoM70ZiPlsiHwRlXIJSTsSLZAUOj+WuBPMfNCvlkzJ2lGHKsFuOD790t4H3A33q/j qSvyOviu3TFykuRmZTvlTEkC91ftZqD9QwEENupFCyjMWGSQndebgqspS0HPWxlXu7y3 sruzdIXhGFydyiSBeX9AdTzWb78LxgAwc4R16PAlGYA6S7WHnLeEewOU4N+AXJPXAXzW UqZzg1mKPBmicAOCCQlKsatbMXqYIqFMTFejTSXy9Ru4xVBqhvIRj8caVOQ4Pg/7ENOB iCtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705930288; x=1706535088; 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=hbpZ5WgGOuXuoHmJv+dMVZWFraOq/OBgW8bdAY+9aBQ=; b=NdgzWBavV6P5o5GprKHX7BrziigHHmN0/XQJjXEY1w9Gb73/TN49y0H7t7Eu5KH/aA VzdkUHdZVQZsw/g5zMQolg8OARcfd2u1wFuVjfnXjorWAs6FEiH0OMUyc8Sq61JU5Yb+ zFrxv9lPeQFMuhLR/bk202gwRv4s8tUT4pEeU+cZGkTtYBV1Np9qRZzkAJSf/bOjhVMo oeAdvURGVeRe21ZYS2ewkQqBiAHApaJwpQqKEjdBrvY3ONh0pNoxMuGsAtyjXW52tUzP 6tgEVNnYkzakXbOCxvPSz63ZX+jH/p1iHD6jQHPOSH3LOOEMPwcHDfpngWYluyqwvEON ww4A== X-Gm-Message-State: AOJu0Yx5HMRr4+q46nca6frMM8JotEbQXva/1z0ryUA0Il3kmm8/6+80 b2EktURapsXf1ykR56nIyIIJMz72SefO9ECU/22nxgY1r4OoDmnE+JMy+sE8 X-Google-Smtp-Source: AGHT+IEWQdC1bNYmxSY7xkK96BPAlyjCY9L6kl7dRy5kyVW43Axs43Lc4zTAHOD+HW8+vz8DylINaA== X-Received: by 2002:a05:651c:1044:b0:2cd:4f2e:f980 with SMTP id x4-20020a05651c104400b002cd4f2ef980mr726709ljm.72.1705930287340; Mon, 22 Jan 2024 05:31:27 -0800 (PST) Received: from localhost.localdomain ([2001:2044:7c:4b00:37f8:fc67:7f51:113d]) by smtp.gmail.com with ESMTPSA id s17-20020a2eb8d1000000b002cccbb7ca38sm3411187ljp.2.2024.01.22.05.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 05:31:26 -0800 (PST) From: Simon Farre To: gdb-patches@sourceware.org Cc: tom@tromey.org, Simon Farre Subject: [PATCH v3 1/5] [dap & linetable]: Add column to linetable entry Date: Mon, 22 Jan 2024 14:31:11 +0100 Message-ID: <20240122133115.201205-1-simon.farre.cx@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 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+patchwork=sourceware.org@sourceware.org This is the first patch in a series meant to introduce the functionality required to serve the breakpointLocations request in the DAP protocol. It's useful for end users for other reasons, beyond that though. For instance with this data exposed to the end user (via Python, see later patches), a user can implement "step to next breakpoint location on line" on their own, which maybe will be more easily accepted than previous attempts of implementing a "next expression" command that ended up in limbo for various reasons. Such behavior would also provide the functionality required to serve DAP step/next requests with a stepping granularity of "statement". Non-DWARF debug info will just store the value 0 as the column. I specifically made the column field 29 bits, as this means linetable_entry will not increase in size, which seemingly is/was an issue, reading the comment above `linetable_entry`'s definition, though this comment is 25 years old so it may not be relevant anymore. 29 bits can represent about 500 million (29 bits=~500 million). This comment is 25 years old, so it might not be relevant any longer, but I figured making it 29 bits makes it impossible to argue against storing it (since the size doesn't change). No changes has been made to sorting of the entries etc. They work just like before, just that now entries store a "column" field. v2: Fix breaking tests watchpoint.exp uses until for no reason really. And because it uses until, it expects to step out of the for loop - but since we now record "logical breakpoint locations" on a line (i.e the column metadata provided by the compilers) "until" may not necessarily "move forward" (unless, of course, explicitly given a line number). By "no reason", I mean that no watchpoint is triggered during an "until" command, so there's no reason to use in the test. After discussion on IRC, the `until` command probably has a bug, because it's expected to move to the "next line" and step out of a for loop, for instance. v3: Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31271 --- gdb/buildsym-legacy.c | 4 ++-- gdb/buildsym-legacy.h | 2 +- gdb/buildsym.c | 3 ++- gdb/buildsym.h | 4 ++-- gdb/coffread.c | 4 ++-- gdb/dbxread.c | 6 ++--- gdb/dwarf2/read.c | 24 +++++++++++++++---- gdb/mdebugread.c | 2 +- gdb/symtab.h | 9 +++++-- gdb/testsuite/gdb.base/watchpoint.exp | 16 ++++--------- .../dw2-out-of-range-end-of-seq.exp | 2 +- 11 files changed, 44 insertions(+), 32 deletions(-) diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c index 84bc96e843b..f267896a3b6 100644 --- a/gdb/buildsym-legacy.c +++ b/gdb/buildsym-legacy.c @@ -205,12 +205,12 @@ finish_block (struct symbol *symbol, struct pending_block *old_blocks, } void -record_line (struct subfile *subfile, int line, unrelocated_addr pc) +record_line (struct subfile *subfile, int line, uint col, unrelocated_addr pc) { gdb_assert (buildsym_compunit != nullptr); /* Assume every line entry is a statement start, that is a good place to put a breakpoint for that line number. */ - buildsym_compunit->record_line (subfile, line, pc, LEF_IS_STMT); + buildsym_compunit->record_line (subfile, line, col, pc, LEF_IS_STMT); } /* Start a new compunit_symtab for a new source file in OBJFILE. Called, for diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h index 1fb545831b8..45eacb15d30 100644 --- a/gdb/buildsym-legacy.h +++ b/gdb/buildsym-legacy.h @@ -76,7 +76,7 @@ extern struct context_stack *push_context (int desc, CORE_ADDR valu); extern struct context_stack pop_context (); -extern void record_line (struct subfile *subfile, int line, +extern void record_line (struct subfile *subfile, int line, uint col, unrelocated_addr pc); extern struct compunit_symtab *start_compunit_symtab (struct objfile *objfile, diff --git a/gdb/buildsym.c b/gdb/buildsym.c index a963219a0d2..75229d6ccda 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -623,7 +623,7 @@ buildsym_compunit::pop_subfile () line vector for SUBFILE. */ void -buildsym_compunit::record_line (struct subfile *subfile, int line, +buildsym_compunit::record_line (struct subfile *subfile, int line, uint col, unrelocated_addr pc, linetable_entry_flags flags) { m_have_line_numbers = true; @@ -664,6 +664,7 @@ buildsym_compunit::record_line (struct subfile *subfile, int line, subfile->line_vector_entries.emplace_back (); linetable_entry &e = subfile->line_vector_entries.back (); e.line = line; + e.col = col; e.is_stmt = (flags & LEF_IS_STMT) != 0; e.set_unrelocated_pc (pc); e.prologue_end = (flags & LEF_PROLOGUE_END) != 0; diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 79ece794559..a7f9c45b936 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -243,8 +243,8 @@ struct buildsym_compunit const char *pop_subfile (); - void record_line (struct subfile *subfile, int line, unrelocated_addr pc, - linetable_entry_flags flags); + void record_line (struct subfile *subfile, int line, uint col, + unrelocated_addr pc, linetable_entry_flags flags); struct compunit_symtab *get_compunit_symtab () { diff --git a/gdb/coffread.c b/gdb/coffread.c index 30a38035c52..77f9c11146b 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1097,7 +1097,7 @@ coff_symtab_read (minimal_symbol_reader &reader, other statement-line-number. */ if (fcn_last_line == 1) record_line - (get_current_subfile (), fcn_first_line, + (get_current_subfile (), fcn_first_line, 0, unrelocated_addr (gdbarch_addr_bits_remove (gdbarch, fcn_first_line_addr))); else @@ -1430,7 +1430,7 @@ enter_linenos (file_ptr file_offset, int first_line, { CORE_ADDR addr = lptr.l_addr.l_paddr; record_line (get_current_subfile (), - first_line + L_LNNO32 (&lptr), + first_line + L_LNNO32 (&lptr), 0, unrelocated_addr (gdbarch_addr_bits_remove (gdbarch, addr))); } diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 1734e8062fb..12a3d877ff9 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2478,7 +2478,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, CORE_ADDR addr = last_function_start + valu; record_line - (get_current_subfile (), 0, + (get_current_subfile (), 0, 0, unrelocated_addr (gdbarch_addr_bits_remove (gdbarch, addr) - objfile->text_section_offset ())); } @@ -2688,14 +2688,14 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, last_function_start : valu; record_line - (get_current_subfile (), desc, + (get_current_subfile (), desc, 0, unrelocated_addr (gdbarch_addr_bits_remove (gdbarch, addr) - objfile->text_section_offset ())); sline_found_in_function = 1; } else record_line - (get_current_subfile (), desc, + (get_current_subfile (), desc, 0, unrelocated_addr (gdbarch_addr_bits_remove (gdbarch, valu) - objfile->text_section_offset ())); break; diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index a50248c4d56..a4f62e6c59e 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -18114,6 +18114,10 @@ class lnp_state_machine advance_line (line_delta); } + void set_column (unsigned int column) noexcept { + m_col = column; + } + /* Handle DW_LNS_set_file. */ void handle_set_file (file_name_index file); @@ -18185,6 +18189,8 @@ class lnp_state_machine file_name_index m_file = 1; unsigned int m_line = 1; + unsigned int m_col = 1; + /* These are initialized in the constructor. */ unrelocated_addr m_address; @@ -18215,6 +18221,8 @@ class lnp_state_machine consecutive entries for the same line. This can happen, for example, when discriminators are present. PR 17276. */ unsigned int m_last_line = 0; + unsigned int m_last_col = 0; + bool m_line_has_non_zero_discriminator = false; }; @@ -18318,6 +18326,7 @@ lnp_state_machine::handle_const_add_pc () static int dwarf_record_line_p (struct dwarf2_cu *cu, unsigned int line, unsigned int last_line, + uint col, uint last_col, int line_has_non_zero_discriminator, struct subfile *last_subfile) { @@ -18325,6 +18334,8 @@ dwarf_record_line_p (struct dwarf2_cu *cu, return 1; if (line != last_line) return 1; + else if(line == last_line && col != last_col) + return 1; /* Same line for the same file that we've seen already. As a last check, for pr 17276, only record the line if the line has never had a non-zero discriminator. */ @@ -18338,7 +18349,7 @@ dwarf_record_line_p (struct dwarf2_cu *cu, static void dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile, - unsigned int line, unrelocated_addr address, + unsigned int line, uint col, unrelocated_addr address, linetable_entry_flags flags, struct dwarf2_cu *cu) { @@ -18355,7 +18366,7 @@ dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile, } if (cu != nullptr) - cu->get_builder ()->record_line (subfile, line, addr, flags); + cu->get_builder ()->record_line (subfile, line, col, addr, flags); } /* Subroutine of dwarf_decode_lines_1 to simplify it. @@ -18378,7 +18389,7 @@ dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile, paddress (gdbarch, (CORE_ADDR) address)); } - dwarf_record_line_1 (gdbarch, subfile, 0, address, LEF_IS_STMT, cu); + dwarf_record_line_1 (gdbarch, subfile, 0, 0, address, LEF_IS_STMT, cu); } void @@ -18444,17 +18455,19 @@ lnp_state_machine::record_line (bool end_sequence) lte_flags |= LEF_IS_STMT; if (dwarf_record_line_p (m_cu, m_line, m_last_line, + m_col, m_last_col, m_line_has_non_zero_discriminator, m_last_subfile)) { buildsym_compunit *builder = m_cu->get_builder (); dwarf_record_line_1 (m_gdbarch, builder->get_current_subfile (), - m_line, m_address, lte_flags, + m_line, m_col, m_address, lte_flags, m_currently_recording_lines ? m_cu : nullptr); } m_last_subfile = m_cu->get_builder ()->get_current_subfile (); m_last_line = m_line; + m_last_col = m_col; } } @@ -18670,7 +18683,8 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, } break; case DW_LNS_set_column: - (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + state_machine.set_column ( + read_unsigned_leb128 (abfd, line_ptr, &bytes_read)); line_ptr += bytes_read; break; case DW_LNS_negate_stmt: diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 73df0ed8165..b5cbe4548a7 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -4008,7 +4008,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) { /* Handle encoded stab line number. */ record_line - (get_current_subfile (), sh.index, + (get_current_subfile (), sh.index, 0, unrelocated_addr (gdbarch_addr_bits_remove (gdbarch, valu))); } diff --git a/gdb/symtab.h b/gdb/symtab.h index eecd999b7e6..38d08fe8599 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1616,14 +1616,19 @@ struct linetable_entry return m_pc < other.m_pc; } - /* Two entries are equal if they have the same line and PC. The + /* Two entries are equal if they have the same line, PC and col. The other members are ignored. */ bool operator== (const linetable_entry &other) const - { return line == other.line && m_pc == other.m_pc; } + { return line == other.line && m_pc == other.m_pc && col == other.col; } /* The line number for this entry. */ int line; + /* The column number for entry. Assume a maximum of circa 500M columns, + a similar assumption is made for line after all. Keeps an identical + size for linetable_entry (16 bytes). */ + unsigned int col : 29; + /* True if this PC is a good location to place a breakpoint for LINE. */ bool is_stmt : 1; diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 2449663ef8b..83fc42c0f6c 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -327,19 +327,11 @@ proc test_stepping {} { # stepping through the loop once, and the debugger should not # stop for any of the remaining iterations. - gdb_test "until" "ival1 = count.*" "until to ival1 assignment" - gdb_test "until" "ival3 = count.*" "until to ival3 assignment" - set test "until out of loop" - gdb_test_multiple "until" $test { - -re "(for \\(count = 0|\}).*$gdb_prompt $" { - gdb_test "until" "ival1 = count; /. Outside loop ./" $test - } - -re "ival1 = count; /. Outside loop ./.*$gdb_prompt $" { - pass $test - } - } + gdb_test "tbreak watchpoint.c:185" \ + ".*watchpoint.c:185.*" \ + "set temporarybreakpoint to before assignment of ival2" - gdb_test "step" "ival2 = count.*" "step to ival2 assignment" + gdb_test "continue" "ival2 = count.*" "cont to ival2 assignment" # Check that the watchpoint is triggered during a step. gdb_test "step" \ diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp index 060b5b6dbfa..33c417576e6 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp @@ -84,7 +84,7 @@ if ![runto_main] { } set test "END with address 1 eliminated" -gdb_test_multiple "maint info line-table \\b$srcfile$" $test { +gdb_test_multiple "maint info line-table $srcfile" $test { -re -wrap "END *0x0*1 *$hex *Y *\r\n.*" { fail $gdb_test_name } From patchwork Mon Jan 22 13:31:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Farre X-Patchwork-Id: 84551 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A5E438582AF for ; Mon, 22 Jan 2024 13:32:03 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id 989D23858409 for ; Mon, 22 Jan 2024 13:31:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 989D23858409 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 989D23858409 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930293; cv=none; b=cEJjv9tu3bkl0Bio4srtHw2sit3/0R7wSEBKlK5aiCG6fgPEg0NaHKWRAlfybFvcelhd4YfU2OBZHD3UvwTtj7EnMaFwnoWjr0cI4z4ZoUXm44HTBYj3meS0pUXwnf/1MJGlBnOiBdnVHmCX7o3BcZAX+OlRgJ/E1L08M3KtyIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930293; c=relaxed/simple; bh=0gy0V48gRmVib/cuzzI9akcDO+jIQ6X443IbDzfPjcw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tVSm/+9pTX5W0dsNtbVsqyMt+o0D5gux7ZG4Dr6IrdXtzxlZCQBeYZgFN6wgzpCMA5RltGn+DhMziUqhhnMNqH7gFwo8Uufe0TsSjF41jzdRg4eqPIhCIc0+PIFE/MkLru+6EMyJjZ/PCJg1u+FPnWhxvz6AaZ9x3qxauFCxbZ0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2cd2f472665so29529651fa.2 for ; Mon, 22 Jan 2024 05:31:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705930289; x=1706535089; darn=sourceware.org; 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=Sz+p7lOr4e3MIp3X2615tboC6653nlYy8HYPMIvS4fE=; b=N1j6H+UPudRcV4NiiM/6iD0Iubdy9eTWm86t8E1/rP2dEArw0lcQPo8sTtbdgLD4kg uzd55KTCs52ZLHQn+i0jb3x0NHa3SfSkrdFN1FUZg0+tbmnP7KTxgmHT8ZRO00VQTSev EZWWSNAFQsDu255+AyIcabxr3GlBSJthRwypaeEX0ylqULAZTr6mG8V8xwrt3uQVA2sA ioOE2zYZuGi2ByvrhMm/18upLmGsCPJZhMhn6LgKZfTwU1dbx5OUzeR9PeFeoO67t1g0 aSFBziZB5Aiyi8y/v9IVvEjIiMx4r9r7VtaO9P0iAeyPuAGba/UzzthA4XeIOzan4pYN 9Iug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705930289; x=1706535089; 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=Sz+p7lOr4e3MIp3X2615tboC6653nlYy8HYPMIvS4fE=; b=xQGALq2SZKUauALBsFOpSql1MzIzEmv6FDggAys8M8hlyi+BPvOKp2bFO6XfjKt92B xgnNveI44K4cx4cIgJgwD5JgcZ/20KoL75Fz9e5JQRSvAZO0u1gWdgQcVAhY4b8a3jNZ bNxOMJJad95sGz/dEz986a89LzrUDO5zWi0Qf9GHUtBRxoLsWSPHzYN9cMCg+brX8+Wv dige3jJh9Zf0pfyj7VpcO2IZvpSpROKikR4x2LloQHCdqRj77BmsaEgNqqgUN4884Uqq H5mVw82oOoEm6RYuOX2HMk913FVSVBxAX2sDbZyX1WM6uur+3odYcmMJBTzYwDI8GyY5 rgFw== X-Gm-Message-State: AOJu0YzmnqOyIDvtNuQjkMTfgWTHGNiBQzuckiZqLvJ3n631/NVeeB1k tjpfPQwyKkvPhV6LnQkZzBY3w2RKPm51Gg2JQvP0uQYOChGAberku2jW+cjj X-Google-Smtp-Source: AGHT+IG95NefQ8vEHiz0ajw8cMjsp7Mov6Airw/0QMJTUIWYVVfYVZADtO9gyjhx42FjnTaxbaf4lw== X-Received: by 2002:a05:651c:1510:b0:2cd:3300:bde2 with SMTP id e16-20020a05651c151000b002cd3300bde2mr1830443ljf.0.1705930289376; Mon, 22 Jan 2024 05:31:29 -0800 (PST) Received: from localhost.localdomain ([2001:2044:7c:4b00:37f8:fc67:7f51:113d]) by smtp.gmail.com with ESMTPSA id s17-20020a2eb8d1000000b002cccbb7ca38sm3411187ljp.2.2024.01.22.05.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 05:31:29 -0800 (PST) From: Simon Farre To: gdb-patches@sourceware.org Cc: tom@tromey.org, Simon Farre Subject: [PATCH v3 2/5] [dap & linetable]: Add column to maint info linetable output Date: Mon, 22 Jan 2024 14:31:12 +0100 Message-ID: <20240122133115.201205-2-simon.farre.cx@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122133115.201205-1-simon.farre.cx@gmail.com> References: <20240122133115.201205-1-simon.farre.cx@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 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+patchwork=sourceware.org@sourceware.org This adds "COL" to the output of the maintenance command "info line-table" v2. maint info line-table: Make display of column optional Toggle the display (on) of column meta data by adding `-show-col` to the command. This command is used way too much in testing to change at this point making any feature that touches this almost impossible to move forward due to test maintenance hell. v3: Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31271 --- gdb/symmisc.c | 102 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 26 deletions(-) diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 5dfb9fca8f0..b7dccb3893e 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -937,17 +937,67 @@ block_depth (const struct block *block) } return i; } - + +static void +output_lt_row (ui_out *uiout, int i, const linetable_entry &item, + const objfile *obj) +{ + ui_out_emit_tuple tuple_emitter (uiout, nullptr); + uiout->field_signed ("index", i); + if (item.line > 0) + { + uiout->field_signed ("line", item.line); + } + else + { + uiout->field_string ("line", _ ("END")); + } + uiout->field_core_addr ("rel-address", obj->arch (), item.pc (obj)); + uiout->field_core_addr ("unrel-address", obj->arch (), + CORE_ADDR (item.unrelocated_pc ())); + uiout->field_string ("is-stmt", item.is_stmt ? "Y" : ""); + uiout->field_string ("prologue-end", item.prologue_end ? "Y" : ""); + uiout->field_string ("epilogue-begin", item.epilogue_begin ? "Y" : ""); + uiout->text ("\n"); +} + +static auto +output_lt_row_with_col (ui_out *uiout, int i, const linetable_entry &item, + const objfile *obj) +{ + ui_out_emit_tuple tuple_emitter (uiout, nullptr); + uiout->field_signed ("index", i); + if (item.line > 0) + { + uiout->field_signed ("line", item.line); + uiout->field_signed ("col", item.col); + } + else + { + uiout->field_string ("line", _ ("END")); + uiout->field_string ("col", _ ("END")); + } + uiout->field_core_addr ("rel-address", obj->arch (), item.pc (obj)); + uiout->field_core_addr ("unrel-address", obj->arch (), + CORE_ADDR (item.unrelocated_pc ())); + uiout->field_string ("is-stmt", item.is_stmt ? "Y" : ""); + uiout->field_string ("prologue-end", item.prologue_end ? "Y" : ""); + uiout->field_string ("epilogue-begin", item.epilogue_begin ? "Y" : ""); + uiout->text ("\n"); +} /* Used by MAINTENANCE_INFO_LINE_TABLES to print the information about a single line table. */ static int -maintenance_print_one_line_table (struct symtab *symtab, void *data) +maintenance_print_one_line_table (struct symtab *symtab, void *data, + bool display_col) { const struct linetable *linetable; struct objfile *objfile; + const auto columns = display_col ? 8 : 7; + objfile = symtab->compunit ()->objfile (); gdb_printf (_("objfile: %ps ((struct objfile *) %s)\n"), styled_string (file_name_style.style (), @@ -973,9 +1023,11 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data) /* Leave space for 6 digits of index and line number. After that the tables will just not format as well. */ struct ui_out *uiout = current_uiout; - ui_out_emit_table table_emitter (uiout, 7, -1, "line-table"); + ui_out_emit_table table_emitter (uiout, columns, -1, "line-table"); uiout->table_header (6, ui_left, "index", _("INDEX")); uiout->table_header (6, ui_left, "line", _("LINE")); + if (display_col) + uiout->table_header (6, ui_left, "col", _("COL")); uiout->table_header (18, ui_left, "rel-address", _("REL-ADDRESS")); uiout->table_header (18, ui_left, "unrel-address", _("UNREL-ADDRESS")); uiout->table_header (7, ui_left, "is-stmt", _("IS-STMT")); @@ -983,26 +1035,12 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data) uiout->table_header (14, ui_left, "epilogue-begin", _("EPILOGUE-BEGIN")); uiout->table_body (); - for (int i = 0; i < linetable->nitems; ++i) - { - const linetable_entry *item; - - item = &linetable->item [i]; - ui_out_emit_tuple tuple_emitter (uiout, nullptr); - uiout->field_signed ("index", i); - if (item->line > 0) - uiout->field_signed ("line", item->line); - else - uiout->field_string ("line", _("END")); - uiout->field_core_addr ("rel-address", objfile->arch (), - item->pc (objfile)); - uiout->field_core_addr ("unrel-address", objfile->arch (), - CORE_ADDR (item->unrelocated_pc ())); - uiout->field_string ("is-stmt", item->is_stmt ? "Y" : ""); - uiout->field_string ("prologue-end", item->prologue_end ? "Y" : ""); - uiout->field_string ("epilogue-begin", item->epilogue_begin ? "Y" : ""); - uiout->text ("\n"); - } + if (display_col) + for (int i = 0; i < linetable->nitems; ++i) + output_lt_row_with_col (uiout, i, linetable->item[i], objfile); + else + for (int i = 0; i < linetable->nitems; ++i) + output_lt_row (uiout, i, linetable->item[i], objfile); } return 0; @@ -1011,9 +1049,20 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data) /* Implement the 'maint info line-table' command. */ static void -maintenance_info_line_tables (const char *regexp, int from_tty) +maintenance_info_line_tables (const char* args, int from_tty) { dont_repeat (); + const char* regexp = nullptr; + bool show_column = false; + gdb_argv argv (args); + + for (auto i = 0; argv != nullptr && argv[i] != nullptr; ++i) + { + if (strcmp (argv[i], "-show-col") == 0) + show_column = true; + else + regexp = argv[i]; + } if (regexp != NULL) re_comp (regexp); @@ -1030,7 +1079,7 @@ maintenance_info_line_tables (const char *regexp, int from_tty) if (regexp == NULL || re_exec (symtab_to_filename_for_display (symtab))) { - maintenance_print_one_line_table (symtab, NULL); + maintenance_print_one_line_table (symtab, NULL, show_column); gdb_printf ("\n"); } } @@ -1080,7 +1129,8 @@ With an argument REGEXP, list the symbol tables with matching names."), add_cmd ("line-table", class_maintenance, maintenance_info_line_tables, _("\ List the contents of all line tables, from all symbol tables.\n\ With an argument REGEXP, list just the line tables for the symbol\n\ -tables with matching names."), +tables with matching names.\n\ +With the argument -show-col this command also displays column information."), &maintenanceinfolist); add_cmd ("check-symtabs", class_maintenance, maintenance_check_symtabs, From patchwork Mon Jan 22 13:31:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Farre X-Patchwork-Id: 84553 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 06A53385842D for ; Mon, 22 Jan 2024 13:32:26 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 477B43858401 for ; Mon, 22 Jan 2024 13:31:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 477B43858401 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 477B43858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930295; cv=none; b=eSkkbwxTS7qaQe7bijNwcjVK8Gh/n0q238Dwu6tXom0bKiz1tQjFcdyYIPZ/ab5CV9ZfLUYPffe2YciLhurcnMGbMVc4/nMKmllXblLebMTes5OLc9Kn1AEXWJwzVPlJDweFze48l/v1EW72fb/w19mz+CVb4L3ITc9IS89tcjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930295; c=relaxed/simple; bh=5vqjhPiWD2dJYcgyQydRgfTxtzw8ueZaraMckgbAzzw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=asDlcSgR7peLec7HEbknuP+yikhTMYTehXR5MlPYVNdSIoPa+sa2CfzAmA28qcAbl13/qPanVfIbz2VNxnOU9NfyOnQcOHBETWNciMhOB007K7fOPVHTF6IMiKP1mCUbIwlD2D7wcM/7F/JG6iGTvbMoQEBpXY9JX+aa+BuAbCI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2cd8bd6ce1bso31146411fa.1 for ; Mon, 22 Jan 2024 05:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705930290; x=1706535090; darn=sourceware.org; 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=TIN3tSznGv9wwnljzJWSuuB2O7YAGo1wxMKb9SOEDLI=; b=C9T7BYFn7p0l9BaR0UGu1zcyq1aF070ujyEzyjnSLTM9sWr4ME5RImBNkhXuGobJ/q i8I2mF0qUKJraolEDF0n3yltOCtSujEL0qRzHx7uwT4H3ZVPM4xDdC0/8Ni1LABAXOdE BtH0rlLOjRz4qlCIz9Ic1kEiSzj0870gPD/0GqJcbE3WCOpNxy60amFVcGmoiN25OTdO rg4yiKCqVAHKBdkQeRRDhIfnigHK9XMg1DxlZwrhhdOt18xV0/CiYwFFha9C0l3lJHxP fnT8oZ1T0CIBZ7oM0aa58KKm3TWzm94x3vXToNwj5ddFZU2IwatPdJ55pON/0SChJPWk uHEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705930290; x=1706535090; 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=TIN3tSznGv9wwnljzJWSuuB2O7YAGo1wxMKb9SOEDLI=; b=g74zPVsHin+Q2YtR8gHz2WGzVfAtK+Z3hB3fIAeLc1qHL2xNhccJy+dT7zR0+h/Rtn XvS0YedxSlegk9HMcyWcfMUOAG7VW2yZIx9HD9yqNVGJSDP8+eFqaeNrHZogB5CpCJJQ 0d0NmvivDPLRO7sCXeG0P9zUXqz8HG/LkT1cEvR88bypbY7hd5UsCxDV346YcKPiQfFq nxQ/GlFGVlHR17XbW1JLyLjbd0xwSlC5S1X7eZWdaD7OMjzHe3fKQyze2GGQvaKwHJle SHd3KKeCQ8WVpY9qcJZOeoYd+qc7sKvjCjVS1SH8W9K9i/OPg36Br7Re22QpWxvW7OYv JgRw== X-Gm-Message-State: AOJu0Yz6eifNLEwxgulptkU9Mq5xeo20/x0OvvG7/qQ5GBclUUmOgPkC 733hptxKKYMEAQbD3FaTw2X7vsJGyCPnXBctpuJnUlpCBcrZ4jaxe+aZo91b X-Google-Smtp-Source: AGHT+IGl/ygc8X+SDXXe1TteJGSt3p5M1Qebs1BQvNt3Xzr+qUfeyBCDoPKyvAqSr8jNh1lIZcJtxg== X-Received: by 2002:a05:651c:b0c:b0:2cc:cbd9:b3d7 with SMTP id b12-20020a05651c0b0c00b002cccbd9b3d7mr1364744ljr.28.1705930290109; Mon, 22 Jan 2024 05:31:30 -0800 (PST) Received: from localhost.localdomain ([2001:2044:7c:4b00:37f8:fc67:7f51:113d]) by smtp.gmail.com with ESMTPSA id s17-20020a2eb8d1000000b002cccbb7ca38sm3411187ljp.2.2024.01.22.05.31.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 05:31:29 -0800 (PST) From: Simon Farre To: gdb-patches@sourceware.org Cc: tom@tromey.org, Simon Farre Subject: [PATCH v3 3/5] [dap & linetable]: Change gdb.LineTableEntry & Add gdb.lookup_linetable Date: Mon, 22 Jan 2024 14:31:13 +0100 Message-ID: <20240122133115.201205-3-simon.farre.cx@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122133115.201205-1-simon.farre.cx@gmail.com> References: <20240122133115.201205-1-simon.farre.cx@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 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+patchwork=sourceware.org@sourceware.org This patch changes the Python type `LineTableEntry` by adding the `column` accessor which returns the newly added `column` value from the internal linetable_entry. It also exposes a new "module function": gdb.lookup_linetable which searches all symbtabs using a string; comparing it with the symtabs 'fullname' and returning the linetable of the (first) symtab that matches. To search for a linetable from python: lt = gdb.lookup_linetable("main.cpp") And like before (as per current documentation), one can use that like so: for lte in lt: print(f"line:col={lte.line}:{lte.column}; pc = {hex(lte.pc)}") Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31271 --- gdb/python/py-linetable.c | 35 ++++++++++++++++++++++++----------- gdb/python/py-symtab.c | 33 +++++++++++++++++++++++++++++++++ gdb/python/python-internal.h | 2 ++ gdb/python/python.c | 2 ++ gdb/symtab.c | 19 ++++++++++++++++++- gdb/symtab.h | 3 +++ 6 files changed, 82 insertions(+), 12 deletions(-) diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c index 788a6e1e24b..ba96c663027 100644 --- a/gdb/python/py-linetable.c +++ b/gdb/python/py-linetable.c @@ -24,6 +24,8 @@ struct linetable_entry_object { PyObject_HEAD /* The line table source line. */ int line; + /* The line table source column. */ + int col; /* The pc associated with the source line. */ CORE_ADDR pc; }; @@ -99,7 +101,7 @@ symtab_to_linetable_object (PyObject *symtab) and an address. */ static PyObject * -build_linetable_entry (int line, CORE_ADDR address) +build_linetable_entry (int line, int col, CORE_ADDR address) { linetable_entry_object *obj; @@ -109,6 +111,7 @@ build_linetable_entry (int line, CORE_ADDR address) { obj->line = line; obj->pc = address; + obj->col = col; } return (PyObject *) obj; @@ -121,7 +124,7 @@ build_linetable_entry (int line, CORE_ADDR address) address. */ static PyObject * -build_line_table_tuple_from_pcs (int line, const std::vector &pcs) +build_line_table_tuple_from_pcs (int line, const symtab& sym, const std::vector &pcs) { int i; @@ -133,10 +136,11 @@ build_line_table_tuple_from_pcs (int line, const std::vector &pcs) if (tuple == NULL) return NULL; + const auto of = sym.compunit ()->objfile (); for (i = 0; i < pcs.size (); ++i) { - CORE_ADDR pc = pcs[i]; - gdbpy_ref<> obj (build_linetable_entry (line, pc)); + const auto& lte = pcs[i]; + gdbpy_ref<> obj (build_linetable_entry (line, lte.col, lte.pc (of))); if (obj == NULL) return NULL; @@ -152,12 +156,10 @@ build_line_table_tuple_from_pcs (int line, const std::vector &pcs) in the line table. */ static PyObject * -ltpy_get_pcs_for_line (PyObject *self, PyObject *args) +ltpy_get_ltes_for_line (PyObject *self, PyObject *args) { struct symtab *symtab; gdb_py_longest py_line; - const linetable_entry *best_entry = nullptr; - std::vector pcs; LTPY_REQUIRE_VALID (self, symtab); @@ -166,14 +168,15 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args) try { - pcs = find_pcs_for_symtab_line (symtab, py_line, &best_entry); + const auto ltes = find_ltes_for_symtab_line (*symtab, py_line); + return build_line_table_tuple_from_pcs (py_line, *symtab, ltes); } catch (const gdb_exception &except) { GDB_PY_HANDLE_EXCEPTION (except); } - return build_line_table_tuple_from_pcs (py_line, pcs); + Py_RETURN_NONE; } /* Implementation of gdb.LineTable.has_line (self, line) -> Boolean. @@ -327,6 +330,14 @@ ltpy_entry_get_line (PyObject *self, void *closure) return gdb_py_object_from_longest (obj->line).release (); } +static PyObject * +ltpy_entry_get_column (PyObject *self, void *closure) +{ + linetable_entry_object *obj = (linetable_entry_object *) self; + + return gdb_py_object_from_longest (obj->col).release (); +} + /* Implementation of gdb.LineTableEntry.pc (self) -> Long. Returns a a long integer associated with the PC of the line table entry. */ @@ -422,7 +433,7 @@ ltpy_iternext (PyObject *self) } struct objfile *objfile = symtab->compunit ()->objfile (); - obj = build_linetable_entry (item->line, item->pc (objfile)); + obj = build_linetable_entry (item->line, item->col, item->pc (objfile)); iter_obj->current_index++; return obj; @@ -451,7 +462,7 @@ GDBPY_INITIALIZE_FILE (gdbpy_initialize_linetable); static PyMethodDef linetable_object_methods[] = { - { "line", ltpy_get_pcs_for_line, METH_VARARGS, + { "line", ltpy_get_ltes_for_line, METH_VARARGS, "line (lineno) -> Tuple\n\ Return executable locations for a given source line." }, { "has_line", ltpy_has_line, METH_VARARGS, @@ -548,6 +559,8 @@ PyTypeObject ltpy_iterator_object_type = { static gdb_PyGetSetDef linetable_entry_object_getset[] = { { "line", ltpy_entry_get_line, NULL, "The line number in the source file.", NULL }, + { "column", ltpy_entry_get_column, NULL, + "The column number in the source file", NULL }, { "pc", ltpy_entry_get_pc, NULL, "The memory address for this line number.", NULL }, { NULL } /* Sentinel */ diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c index b28f6ca8b48..e23c02aa0e4 100644 --- a/gdb/python/py-symtab.c +++ b/gdb/python/py-symtab.c @@ -475,6 +475,39 @@ symtab_to_symtab_object (struct symtab *symtab) return (PyObject *) symtab_obj; } +/* Search for a symtab whose fullname contains FILENAME and return it's + linetable. */ +PyObject * +gdbpy_lookup_linetable_by_filename (PyObject *, PyObject *args, PyObject *kw) +{ + const char *arg = nullptr; + static const char *keywords[] = { "filename", nullptr }; + + if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &arg)) + { + return nullptr; + } + + for (objfile *objfile : current_program_space->objfiles ()) + for (compunit_symtab *cu : objfile->compunits ()) + for (symtab *s : cu->filetabs ()) + { + const auto name = symtab_to_fullname (s); + + if (strstr (name, arg)) + { + auto symtab_pyobj = symtab_to_symtab_object (s); + if (!symtab_pyobj) + Py_RETURN_NONE; + auto lt_obj = symtab_to_linetable_object (symtab_pyobj); + if (!lt_obj) + Py_RETURN_NONE; + return lt_obj; + } + } + Py_RETURN_NONE; +} + /* Create a new symtab and line (gdb.Symtab_and_line) object that encapsulates the symtab_and_line structure from GDB. */ PyObject * diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 7c05007cbab..dcfc03e3beb 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -408,6 +408,8 @@ PyObject *gdbpy_convenience_variable (PyObject *self, PyObject *args); PyObject *gdbpy_set_convenience_variable (PyObject *self, PyObject *args); PyObject *gdbpy_breakpoints (PyObject *, PyObject *); PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *); +PyObject *gdbpy_lookup_linetable_by_filename (PyObject *, PyObject* args, + PyObject *kw); PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw); PyObject *gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw); diff --git a/gdb/python/python.c b/gdb/python/python.c index 1d406392bd3..3d7c70fed09 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -2573,6 +2573,8 @@ gdbpy_initialized (const struct extension_language_defn *extlang) PyMethodDef python_GdbMethods[] = { + { "lookup_linetable", (PyCFunction) gdbpy_lookup_linetable_by_filename, + METH_VARARGS | METH_KEYWORDS }, { "history", gdbpy_history, METH_VARARGS, "Get a value from history" }, { "add_history", gdbpy_add_history, METH_VARARGS, diff --git a/gdb/symtab.c b/gdb/symtab.c index 7c0a69108d4..e206ba9cada 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3519,7 +3519,24 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line, return result; } - +/** Return line table entries for SYMTAB at LINE. */ + +std::vector +find_ltes_for_symtab_line (const symtab &symtab, int line) +{ + auto lte = symtab.linetable (); + if (lte == nullptr) + return {}; + + std::vector result; + for (auto i = 0; i < lte->nitems; ++i) + { + if (lte->item[i].line == line) + result.push_back (lte->item[i]); + } + return result; +} + /* Set the PC value for a given source file and line number and return true. Returns false for invalid line number (and sets the PC to 0). The source file is specified with a struct symtab. */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 38d08fe8599..9098822c90b 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2772,6 +2772,9 @@ void iterate_over_symtabs (const char *name, std::vector find_pcs_for_symtab_line (struct symtab *symtab, int line, const linetable_entry **best_entry); +std::vector find_ltes_for_symtab_line + (const symtab &symtab, int line); + /* Prototype for callbacks for LA_ITERATE_OVER_SYMBOLS. The callback is called once per matching symbol SYM. The callback should return true to indicate that LA_ITERATE_OVER_SYMBOLS should continue From patchwork Mon Jan 22 13:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Farre X-Patchwork-Id: 84554 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6BDF33858412 for ; Mon, 22 Jan 2024 13:33:04 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by sourceware.org (Postfix) with ESMTPS id 45E3A3858415 for ; Mon, 22 Jan 2024 13:31:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45E3A3858415 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 45E3A3858415 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930295; cv=none; b=BCzn+/ZdrnQZO/2Lpmp6oxv+eTQWjTeYbV7bEWwVZvbS5nRAmAmjx15dug2qmAJmD4p/ZUs8w78oT0Ew9wECETIHduMyWlUVsolY8YNM8BV2SAmGQqqQOrYy8qfAFGxUKsoaF3nrAazRXUh6DBe5r9BAY1JGLhjvpigyP9qe6QI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930295; c=relaxed/simple; bh=WW3Vcy0AVWPQYn3NyNJPfvkzMAqohitQF3pQkFMGKuM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UyuJDzhWMVskacZA/Oyt+5lpoPLBslB9dRrwzobo+GRRcw52bLc5QeZMlCqbN6EPYFkw3DBAaY2tRbFF4V+tbp6Gti0iJaXsuk9lXofl9bQeXXCfPLl8h2JW33/xwGlt5PQfpaYb//iGlJHQfhq8SYXV9MjSlMJK5vUJa5/6VEQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2cd33336b32so40631591fa.0 for ; Mon, 22 Jan 2024 05:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705930291; x=1706535091; darn=sourceware.org; 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=3W8MVlSvpVvu94V6o4V125XVhL0qVTXhc9eG1jvcCiQ=; b=Kz4z1wgTOT+XFhXn6nWTmCk18U+btfD/YQGYbOm+HemeY8yEB+CCupzWTbLA1zX2Uh PiIJbktmJZouMN4BNJBirQ2Fvp7i4bbXTzMxALdXNE8Mbb7UyJqk3aIkolIvqTUHR0Vo I5mZ4w+JtvKQt83h9ITPijh9c5c3Y2tIgeAi6luMc6unJI1j+JPSf5JWGDopOzKy4ITm NKF1IgM9J+5hxMxyRxysyDA3pTq5BoMu6dk5qVNu1h5PDt/g1RS5rM/Cmp768kK3ZsIe VsjnlH8J4o8ZImCzu9d+S4Cv8aalfsvAbM+4p49O45CcRAweLexFfCBprh3GdHNhPuHV v0IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705930291; x=1706535091; 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=3W8MVlSvpVvu94V6o4V125XVhL0qVTXhc9eG1jvcCiQ=; b=lInAEG/HbbD7IUm8ygmj6jFcuermz2MwBt2bg5S8TJavJJXdWXN+X584hxxZaFtqSs mRegOLt1sFniSeCDrtT0Vpp1+BfBXvDnyCDny0QNXjpTp9shN9d3vdM8TK2u0zP2AnUW XZytppQYzUU7KLJwFm/lmGgxLvowbutofHB+D7PZNlnxpvStLm55Ew7RmX5NgjrPm7Rq IwfgfAC8+d2NN/V1U+9tIKXr7QrB8plhXV75UjJdvp1wmXj5DLdniehXo1lP/aiTSxLg iX4oI2r35NZ0cRkRI6qdFtvX5guIE5H6T3FhPklMqhd9C9XK73Tmsmvj32V3twsEpEtn RbuA== X-Gm-Message-State: AOJu0YzWlhY3GKE5Jy2ggHaLyRbk6dMygzhvnavvhXG2Kf220NhKQJNL kXdpAyy3RacayjYDY7/Mzj8C7Gnrhn1C0/+C2XE1GSLdq+NV+SIousqqpem2 X-Google-Smtp-Source: AGHT+IFkXF6F5IWCzQKh6wqnuOxdGzUACFTXxUB7ZaLAd7NGbMzaDJuWHQvmP9kv1EgglcfdNQz+Bw== X-Received: by 2002:a05:651c:2019:b0:2cc:ee59:3de1 with SMTP id s25-20020a05651c201900b002ccee593de1mr1758973ljo.2.1705930291338; Mon, 22 Jan 2024 05:31:31 -0800 (PST) Received: from localhost.localdomain ([2001:2044:7c:4b00:37f8:fc67:7f51:113d]) by smtp.gmail.com with ESMTPSA id s17-20020a2eb8d1000000b002cccbb7ca38sm3411187ljp.2.2024.01.22.05.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 05:31:30 -0800 (PST) From: Simon Farre To: gdb-patches@sourceware.org Cc: tom@tromey.org, Simon Farre Subject: [PATCH v3 4/5] [dap & linetable]: Add breakpointLocations request Date: Mon, 22 Jan 2024 14:31:14 +0100 Message-ID: <20240122133115.201205-4-simon.farre.cx@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122133115.201205-1-simon.farre.cx@gmail.com> References: <20240122133115.201205-1-simon.farre.cx@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 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+patchwork=sourceware.org@sourceware.org This adds the breakpointLocations request. Testing might strictly not be possible for this feature. Users are going to have wildly varying compilers and compiler versions that outputs wildly different debug symbol information. So unless we can restrain the tests to some specific toolchain that I can handroll the tests for, this will not be useful (and handrolling for a specific compiler defeats the purpose - as one can just use the eyes then to verify). v2: Fixed type check issue Forgot the obligatory **args at the end of breakpoint_locations v3: Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31271 --- gdb/python/lib/gdb/dap/breakpoint.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py index 9cbd7ae0c47..70c93b0a03d 100644 --- a/gdb/python/lib/gdb/dap/breakpoint.py +++ b/gdb/python/lib/gdb/dap/breakpoint.py @@ -437,3 +437,30 @@ def set_exception_breakpoints( return { "breakpoints": _set_exception_catchpoints(options), } + + +@in_gdb_thread +def _get_logical_bp_locations(name: str, line: int): + linetable = gdb.lookup_linetable(name) + if linetable is not None: + return [ + {"line": lte.line, "column": lte.column} for lte in linetable.line(line) + ] + else: + return [] + + +@request("breakpointLocations") +@capability("supportsBreakpointLocationsRequest") +def breakpoint_locations( + *, + # This is a Source but we don't type-check it. + source, + line: int, + column: Optional[int], + endLine: Optional[int], + endColumn: Optional[int], + **args, +): + # for now we don't support column, endLine, endColumn. We just return per line + return {"breakpoints": _get_logical_bp_locations(source["path"], line)} From patchwork Mon Jan 22 13:31:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Farre X-Patchwork-Id: 84555 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 570773858409 for ; Mon, 22 Jan 2024 13:33:06 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id 66977385841E for ; Mon, 22 Jan 2024 13:31:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 66977385841E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 66977385841E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930296; cv=none; b=FTR7yjiEi+Uld7ATZi4GlhIojTlNPFZBfPpVwuUXHamzm4i2ZHwpjwV2af7DpFx9W2iqLJo/zA24asqnjR1YSZyMra0h5PKCl9ZwCAeqA1BvC5DDZmUMGrIMOXIC2KGNqfprdvYDBLH25BClo9KHDhOtdTQxAZMI/K8EooUd+HI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705930296; c=relaxed/simple; bh=CSpAUwz2GGJ+T3iPMZYxqPoei9DO5dBbfCvUfkHFG04=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uEkkZf+ffhSJxwgmGwsvpQ438K9jOKEl04+X7eJfBKcUHELqchyXTbuH+mLT4jkFo2b84eQwcdVzOzWlpl0Vj3R/bxxVN/m3PUDnmN2x+s+KOH2rFF7eLLtEvnpSsaVzURcl/1ickPISDpYO/+j8QlLQLW82LJ//j1KMBS92NJA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2cc9fa5e8e1so33658971fa.3 for ; Mon, 22 Jan 2024 05:31:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705930292; x=1706535092; darn=sourceware.org; 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=mB4h/Cb64Jv5qeZXPWvLwTpuec4G+IrUjKqxtdxdntU=; b=LjjB0Ndrrqv2VLDiNdr1OlPN3Pi/y+vFUwfjfcB6cUn60ya1ZrTZDBiDArtvPvl3IT cVriXN2JbWYle0X7XJagVvnNEEhObpZkcOyzrtH4ecLGRnJWcyvXlYWDmBKZxRO0hRWQ Xd9YVvrkMCArzRqxF6j2pu0k3z1Vv/95M556g7EEgiMw/TeafDm5jbc8iZIjn9aCgyh3 Bj/Vk8W/CbIlvLE9qNxe2emFAcIGdvdg9bpC24UkJXcr99VvznHmLQgaImQlo8YH9iE/ duCtK0GXv+pbsgcYVAACyFrX8xsCE6nOET1OcQyK7PhtQRDsd0uTdXE9qrpKH2DECQnh dKAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705930292; x=1706535092; 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=mB4h/Cb64Jv5qeZXPWvLwTpuec4G+IrUjKqxtdxdntU=; b=AYLCyFJZX/PJ22ke/SA/I5W9qQEd6VE7AFJJIK013Fawp2amTMP0lVZpw4JfIl2bGU V1HZCumDiDcpI/RlFq9QO3rYLJHDqn9YLRj7iAd3XVFMDtsOeFaIkZULx4ku7NyUi4vl VSP6jcKnizZ9AQvfWXmVMpRa5R6QYV26wS56fDO5P4OWTYHPTq8GgCqvE6nhzs3GITrW 43rFEGkih2sr2PhSahzIPWnPWw34LYdfVHI/JTXm4RMjNV4YmMjM6McQmVt0oxFp9/eG 5CivoZv4gcDHKeRWE3p9spxpmbJwTYGYBdKBYIhADzgf3z4RS+sqTUKChoaUqlijZ3Tr 3snQ== X-Gm-Message-State: AOJu0YzQfApS9+nCFn9jxUHLpI1GwPBqnoP3Bt5MGXD4s27WV3zXAnPX wTmZ2uWimsofOnOKXR04dUvDm6zeqwVN573FiGNyqNOwl8Ck27ZPHJxOGFnQ X-Google-Smtp-Source: AGHT+IF7PUFOeXL3Jk+XDwD4QGECzr794fsDDBEYA4MvWqE9wssRlhIkWsHRAKXWA6mDHhS/kidxxA== X-Received: by 2002:a2e:824b:0:b0:2cd:f093:7939 with SMTP id j11-20020a2e824b000000b002cdf0937939mr1596076ljh.32.1705930292424; Mon, 22 Jan 2024 05:31:32 -0800 (PST) Received: from localhost.localdomain ([2001:2044:7c:4b00:37f8:fc67:7f51:113d]) by smtp.gmail.com with ESMTPSA id s17-20020a2eb8d1000000b002cccbb7ca38sm3411187ljp.2.2024.01.22.05.31.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 05:31:31 -0800 (PST) From: Simon Farre To: gdb-patches@sourceware.org Cc: tom@tromey.org, Simon Farre Subject: [PATCH v3 5/5] [dap & linetable]: Added docs Date: Mon, 22 Jan 2024 14:31:15 +0100 Message-ID: <20240122133115.201205-5-simon.farre.cx@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122133115.201205-1-simon.farre.cx@gmail.com> References: <20240122133115.201205-1-simon.farre.cx@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 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+patchwork=sourceware.org@sourceware.org Added docs for the new `gdb.lookup_linetable` as well as the new accessor method `LineTableEntry.column`. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31271 --- gdb/doc/python.texi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 71431878dd3..3206aef3b4f 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -6422,6 +6422,18 @@ mapping of source lines to their executable locations in memory. To acquire the line table information for a particular symbol table, use the @code{linetable} function (@pxref{Symbol Tables In Python}). +Python code can request a symtab's linetable by calling +@code{gdb.lookup_linetable} passing in the filename. The parameter +@var{filename} can be a substring of the symtab's @code{fullname}. +If multiple symtabs' fullnames share that substring, the first one +found is returned. + +@defun gdb.lookup_linetable (filename) +Return the @code{gdb.LineTable} of a symtab whose fullname matches +@var{filename}. If no symtab could be found using @var{filename} +as a substring this function returns @code{None}. +@end defun + A @code{gdb.LineTable} is iterable. The iterator returns @code{LineTableEntry} objects that correspond to the source line and address for each line table entry. @code{LineTableEntry} objects have @@ -6433,6 +6445,12 @@ corresponds to the actual line of source. This attribute is not writable. @end defvar +@defvar LineTableEntry.column +The source column number for this line table entry. This number +corresponds to the actual column of source. This attribute is not +writable. +@end defvar + @defvar LineTableEntry.pc The address that is associated with the line table entry where the executable code for that source line resides in memory. This