From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonic310-11.consmr.mail.ir2.yahoo.com (sonic310-11.consmr.mail.ir2.yahoo.com [77.238.177.32]) by sourceware.org (Postfix) with ESMTPS id 35640383F85E for ; Sat, 16 May 2020 17:28:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 35640383F85E X-YMail-OSG: KfUeIUEVM1kZwsgWjR8Er69HRzOhFzAj47C.IDwV0U3.lPx1MkDqaK6vM3npTM5 vjZeyTDk9sDBmeXYhf0risHM0rFcxs47u_y2GshvFKdlVpSwcNYlPYECXcl3cLfV9niHEXDAkUvf sMWLnprxOP.mh72lPckRRnguZRDL7SNTMKoTYC4N6xta67YaAyotWJpUYDTp3aUfls7G0RPNSQSM Ce9PocQBl5OHOIMu5DAPR.x1ZpTn2dMAzZ4VmGkCiiCEW8YU5Zb1IPvF.rwI8e29KKSE2i_GchBC WS0gSjOFEgXl.P0FeLlyXMv3WQaswKNBOUU6gVe9D.UwzpHokbxgHSewLxjJ8GKFTcBTgggl5sxV beyHeDIDGCBfkGHmf6jbOgKmtiVh3213vl8qozGwgmOow0n6ZSATIoWry54WXG1_K_yB_hEbhDLJ rSvVzrcIf6NH.edxKogYm_LFU0SiR8xfob9j2Kp_WBVCH3rwhkh6pC4i6V4zQNzqb4dRE9Tb8uYQ Y55RhHuC.aykNTHlAPzdfJ0LvQEzH5xdCK1_JalMZ8hxxqKC3w8Abe0MdlcsQnbhUSwpx9LEZfTZ IDpZkIXZG7gahuWdMc7NNp7lIomXdz2ZR0EvgjqbsWlUWbKuBN7lQjYsBS14.QBfkmqXRs3ex8rw mvHdxDe03sOm_ZlExNXP9cOAKYdxj6_q6u5W3A7_JnlnYJ_UznPiAiXGfM7NNs7OCP.YRkFH3sdw 6v8hmKoD.K6SP744pXWZah6HORKPg_J_.6Dx6TcLOQMsrg8vDMpSLDE8jPUwE.QdLBgMjVM_S8Eb HmqIr2aDRtp66rGvMquJ5qY5fDqH.VNuMfNRarxhWJP.yFgHNisaAlMs6jbmexE4cA5brh.oxSkc yLFh0TQuO9zYn6MrCmI4_kxaqXv0PchIfj3oMB4R.FyEKUJLlUkV4TxPVPBo9eDksHvINn8CIVtw .3hzt9ZwueGFu6DhPsOr6FokPuKIXteEJ5Zvc5L5cYdPFzReEf.k8gPcIU3zXZAGtxiW3x8Jys6I NAkAP3jQuTzkgf288_QalzFQUN_7mp_z4tXQYFFvi2HtGjCxErgO32yr22RCd.ASyUVhVOC_k2dO bn28m40iSrtV7R05bcnkkbfzURcLk66YA8PvxI8BZkYAgw8UBJhaYPdIlbInEhP5vW78lpCdYYEg tohxDOFu.LMnlqQajcPpIkSDtCTJFtCLp65Myfi10TrAZ4jBVDGBFzcUdJjLlJgpjNqvhJZErs5c zVvyUd3myJoEUjnUtf6rh7Q0Gs32OVd8_un67zrKJEyAOwEj2HYh_4tjyTx7yb3T44x72_Q5EgM1 4SZUGhkGUgNZ9Yo.u.9HICPkTItCzWcjO64qXbZsI87.864AhMasurYRsFCJoNFcvbonuNevmbar hB1bC.4oUPnBBE2rBfLpCgvbgJMZjVg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ir2.yahoo.com with HTTP; Sat, 16 May 2020 17:28:16 +0000 Received: by smtp418.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 8142922a7a13f425a55b77cec3219a55; Sat, 16 May 2020 17:28:14 +0000 (UTC) From: Hannes Domani To: gdb-patches@sourceware.org Subject: [PATCH 1/6] Add column information of dwarf to the symbol information Date: Sat, 16 May 2020 19:26:28 +0200 Message-Id: <20200516172632.4803-2-ssbssa@yahoo.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200516172632.4803-1-ssbssa@yahoo.de> References: <20200516172632.4803-1-ssbssa@yahoo.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Antivirus: Avast (VPS 200515-0, 05/15/2020), Outbound message X-Antivirus-Status: Clean X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FROM, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_STOCKGEN, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2020 17:28:19 -0000 --- gdb/buildsym-legacy.c | 2 +- gdb/buildsym.c | 7 ++++--- gdb/buildsym.h | 2 +- gdb/dwarf2/read.c | 38 ++++++++++++++++++++++++++++++-------- gdb/frame.c | 1 + gdb/symtab.c | 3 +++ gdb/symtab.h | 11 +++++++++++ 7 files changed, 51 insertions(+), 13 deletions(-) diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c index d9c27ebc95..0a4f78fe23 100644 --- a/gdb/buildsym-legacy.c +++ b/gdb/buildsym-legacy.c @@ -254,7 +254,7 @@ record_line (struct subfile *subfile, int line, CORE_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, true); + buildsym_compunit->record_line (subfile, line, pc, true, 0); } /* Start a new symtab for a new source file in OBJFILE. Called, for example, diff --git a/gdb/buildsym.c b/gdb/buildsym.c index b9bcc33080..fa39266269 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -661,12 +661,12 @@ buildsym_compunit::pop_subfile () return name; } -/* Add a linetable entry for line number LINE and address PC to the - line vector for SUBFILE. */ +/* Add a linetable entry for line number LINE, address PC and column + number COLUMN to the line vector for SUBFILE. */ void buildsym_compunit::record_line (struct subfile *subfile, int line, - CORE_ADDR pc, bool is_stmt) + CORE_ADDR pc, bool is_stmt, int column) { struct linetable_entry *e; @@ -719,6 +719,7 @@ buildsym_compunit::record_line (struct subfile *subfile, int line, e->line = line; e->is_stmt = is_stmt ? 1 : 0; e->pc = pc; + e->column = column; } diff --git a/gdb/buildsym.h b/gdb/buildsym.h index c768a4c2da..f4dafb6ba3 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -188,7 +188,7 @@ struct buildsym_compunit const char *pop_subfile (); void record_line (struct subfile *subfile, int line, CORE_ADDR pc, - bool is_stmt); + bool is_stmt, int column); struct compunit_symtab *get_compunit_symtab () { diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index f9d2f255e4..4441c3d390 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -19829,6 +19829,12 @@ class lnp_state_machine advance_line (line_delta); } + /* Handle DW_LNS_set_column. */ + void handle_set_column (unsigned int column) + { + m_column = column; + } + /* Handle DW_LNS_set_file. */ void handle_set_file (file_name_index file); @@ -19890,6 +19896,7 @@ class lnp_state_machine /* The line table index of the current file. */ file_name_index m_file = 1; unsigned int m_line = 1; + unsigned int m_column = 0; /* These are initialized in the constructor. */ @@ -20027,13 +20034,14 @@ dwarf_record_line_p (struct dwarf2_cu *cu, return 0; } -/* Use the CU's builder to record line number LINE beginning at - address ADDRESS in the line table of subfile SUBFILE. */ +/* Use the CU's builder to record line number LINE and column + number COLUMN beginning at address ADDRESS in the line table + of subfile SUBFILE. */ static void dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile, unsigned int line, CORE_ADDR address, bool is_stmt, - struct dwarf2_cu *cu) + struct dwarf2_cu *cu, unsigned int column) { CORE_ADDR addr = gdbarch_addr_bits_remove (gdbarch, address); @@ -20046,7 +20054,7 @@ dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile, } if (cu != nullptr) - cu->get_builder ()->record_line (subfile, line, addr, is_stmt); + cu->get_builder ()->record_line (subfile, line, addr, is_stmt, column); } /* Subroutine of dwarf_decode_lines_1 to simplify it. @@ -20069,7 +20077,7 @@ dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile, paddress (gdbarch, address)); } - dwarf_record_line_1 (gdbarch, subfile, 0, address, true, cu); + dwarf_record_line_1 (gdbarch, subfile, 0, address, true, cu, 0); } void @@ -20117,7 +20125,8 @@ lnp_state_machine::record_line (bool end_sequence) dwarf_record_line_1 (m_gdbarch, builder->get_current_subfile (), m_line, m_address, is_stmt, - m_currently_recording_lines ? m_cu : nullptr); + m_currently_recording_lines ? m_cu : nullptr, + m_column); } m_last_subfile = m_cu->get_builder ()->get_current_subfile (); m_last_line = m_line; @@ -20334,8 +20343,13 @@ 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); - line_ptr += bytes_read; + { + unsigned int column + = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + line_ptr += bytes_read; + + state_machine.handle_set_column (column); + } break; case DW_LNS_negate_stmt: state_machine.handle_negate_stmt (); @@ -20668,6 +20682,14 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, SYMBOL_LINE (sym) = DW_UNSND (attr); } + attr = dwarf2_attr (die, + inlined_func ? DW_AT_call_column : DW_AT_decl_column, + cu); + if (attr != nullptr) + { + SYMBOL_COLUMN (sym) = DW_UNSND (attr); + } + attr = dwarf2_attr (die, inlined_func ? DW_AT_call_file : DW_AT_decl_file, cu); diff --git a/gdb/frame.c b/gdb/frame.c index ff27b9f00e..72062c9f34 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2538,6 +2538,7 @@ find_frame_sal (frame_info *frame) { sal.symtab = symbol_symtab (sym); sal.line = SYMBOL_LINE (sym); + sal.column = SYMBOL_COLUMN (sym); } else /* If the symbol does not have a location, we don't know where diff --git a/gdb/symtab.c b/gdb/symtab.c index 7d4857e323..999c0af8dc 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3325,6 +3325,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) val.is_stmt = best->is_stmt; val.symtab = best_symtab; val.line = best->line; + val.column = best->column; val.pc = best->pc; if (best_end && (!alt || best_end < alt->pc)) val.end = best_end; @@ -3901,6 +3902,7 @@ skip_prologue_sal (struct symtab_and_line *sal) sal->section = section; sal->symtab = start_sal.symtab; sal->line = start_sal.line; + sal->column = start_sal.column; sal->end = start_sal.end; /* Check if we are now inside an inlined function. If we can, @@ -3919,6 +3921,7 @@ skip_prologue_sal (struct symtab_and_line *sal) && SYMBOL_LINE (BLOCK_FUNCTION (function_block)) != 0) { sal->line = SYMBOL_LINE (BLOCK_FUNCTION (function_block)); + sal->column = SYMBOL_COLUMN (BLOCK_FUNCTION (function_block)); sal->symtab = symbol_symtab (BLOCK_FUNCTION (function_block)); } } diff --git a/gdb/symtab.h b/gdb/symtab.h index 764c567a90..c936c858e6 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1191,6 +1191,10 @@ struct symbol : public general_symbol_info, public allocate_on_obstack unsigned short line = 0; + /* Column number of this symbol's definition. */ + + unsigned short column = 0; + /* An arbitrary data pointer, allowing symbol readers to record additional information on a per-symbol basis. Note that this data must be allocated using the same obstack as the symbol itself. */ @@ -1237,6 +1241,7 @@ extern const struct symbol_impl *symbol_impls; (((symbol)->subclass) == SYMBOL_TEMPLATE) #define SYMBOL_TYPE(symbol) (symbol)->type #define SYMBOL_LINE(symbol) (symbol)->line +#define SYMBOL_COLUMN(symbol) (symbol)->column #define SYMBOL_COMPUTED_OPS(symbol) (SYMBOL_IMPL (symbol).ops_computed) #define SYMBOL_BLOCK_OPS(symbol) (SYMBOL_IMPL (symbol).ops_block) #define SYMBOL_REGISTER_OPS(symbol) (SYMBOL_IMPL (symbol).ops_register) @@ -1307,6 +1312,9 @@ struct linetable_entry /* The line number for this entry. */ int line; + /* The column number for this entry. */ + int column; + /* True if this PC is a good location to place a breakpoint for LINE. */ unsigned is_stmt : 1; @@ -1887,6 +1895,9 @@ struct symtab_and_line 0 is never a valid line number; it is used to indicate that line number information is not available. */ int line = 0; + /* Column number. 0 is never a valid column number; it is used to + indicate that column number information is not available. */ + int column = 0; CORE_ADDR pc = 0; CORE_ADDR end = 0; -- 2.26.2