From: Simon Marchi Date: Thu, 16 Oct 2025 00:08:04 +0000 (-0400) Subject: gdb: rename find_line_pc_range -> find_pc_range_for_sal X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de49e8229b4d66beac71a8d7b6dd8e1cacc540c4;p=thirdparty%2Fbinutils-gdb.git gdb: rename find_line_pc_range -> find_pc_range_for_sal Change-Id: Ibd1692292dfcad088ae74b797c38a483080f2ec1 Approved-by: Kevin Buettner --- diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index a2c326b9f3f..494a1773e16 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9482,7 +9482,7 @@ resolve_sal_pc (struct symtab_and_line *sal) if (sal->pc == 0 && sal->symtab != NULL) { - if (!find_line_pc (sal->symtab, sal->line, &pc)) + if (!find_pc_for_line (sal->symtab, sal->line, &pc)) error (_("No line %d in file \"%s\"."), sal->line, symtab_to_filename_for_display (sal->symtab)); sal->pc = pc; @@ -9735,11 +9735,11 @@ find_breakpoint_range_end (struct symtab_and_line sal) int ret; CORE_ADDR start; - ret = find_line_pc_range (sal, &start, &end); + ret = find_pc_range_for_sal (sal, &start, &end); if (!ret) error (_("Could not find location of the end of the range.")); - /* find_line_pc_range returns the start of the next line. */ + /* find_pc_range_for_sal returns the start of the next line. */ end--; } @@ -12851,7 +12851,7 @@ update_static_tracepoint (tracepoint *tp, struct symtab_and_line sal) pc = sal.pc; if (sal.line) - find_line_pc (sal.symtab, sal.line, &pc); + find_pc_for_line (sal.symtab, sal.line, &pc); if (target_static_tracepoint_marker_at (pc, &marker)) { diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c index cb839e742ff..6051cbadefc 100644 --- a/gdb/mi/mi-cmd-disas.c +++ b/gdb/mi/mi-cmd-disas.c @@ -248,7 +248,7 @@ mi_cmd_disassemble (const char *command, const char *const *argv, int argc) s = lookup_symtab (current_program_space, file_string); if (s == NULL) error (_("-data-disassemble: Invalid filename.")); - if (!find_line_pc (s, line_num, &start)) + if (!find_pc_for_line (s, line_num, &start)) error (_("-data-disassemble: Invalid line number")); if (find_pc_partial_function (start, NULL, &low, &high) == 0) error (_("-data-disassemble: " diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index bf1070030e2..2d91bb1667b 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2355,7 +2355,7 @@ mi_cmd_trace_find (const char *command, const char *const *argv, int argc) error (_("Could not find the specified line")); CORE_ADDR start_pc, end_pc; - if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc)) + if (sal.line > 0 && find_pc_range_for_sal (sal, &start_pc, &end_pc)) tfind_1 (tfind_range, 0, start_pc, end_pc - 1, 0); else error (_("Could not find the specified line")); diff --git a/gdb/source.c b/gdb/source.c index 1018d2ce6be..27fa657afb8 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1574,7 +1574,7 @@ info_line_command (const char *arg, int from_tty) gdb_printf ("\n"); } else if (sal.line > 0 - && find_line_pc_range (sal, &start_pc, &end_pc)) + && find_pc_range_for_sal (sal, &start_pc, &end_pc)) { gdbarch *gdbarch = sal.symtab->compunit ()->objfile ()->arch (); diff --git a/gdb/symtab.c b/gdb/symtab.c index bb17276102f..fdba441ec54 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3390,7 +3390,7 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line, The source file is specified with a struct symtab. */ bool -find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc) +find_pc_for_line (struct symtab *symtab, int line, CORE_ADDR *pc) { const struct linetable *l; int ind; @@ -3417,14 +3417,14 @@ find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc) Returns false if could not find the specified line. */ bool -find_line_pc_range (struct symtab_and_line sal, CORE_ADDR *startptr, +find_pc_range_for_sal (struct symtab_and_line sal, CORE_ADDR *startptr, CORE_ADDR *endptr) { CORE_ADDR startaddr; struct symtab_and_line found_sal; startaddr = sal.pc; - if (startaddr == 0 && !find_line_pc (sal.symtab, sal.line, &startaddr)) + if (startaddr == 0 && !find_pc_for_line (sal.symtab, sal.line, &startaddr)) return false; /* This whole function is based on address. For example, if line 10 has diff --git a/gdb/symtab.h b/gdb/symtab.h index 3a2088cb6af..6c19f138c2f 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2434,10 +2434,10 @@ extern struct symtab *find_symtab_for_pc (CORE_ADDR); /* Given a symtab and line number, return the pc there. */ -extern bool find_line_pc (struct symtab *, int, CORE_ADDR *); +extern bool find_pc_for_line (struct symtab *, int, CORE_ADDR *); -extern bool find_line_pc_range (struct symtab_and_line, CORE_ADDR *, - CORE_ADDR *); +extern bool find_pc_range_for_sal (struct symtab_and_line, CORE_ADDR *, + CORE_ADDR *); extern void resolve_sal_pc (struct symtab_and_line *); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index c0db7c8e6fa..9b84fbe384a 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2347,7 +2347,7 @@ tfind_line_command (const char *args, int from_tty) error (_("No line number information available.")); CORE_ADDR start_pc, end_pc; - if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc)) + if (sal.line > 0 && find_pc_range_for_sal (sal, &start_pc, &end_pc)) { if (start_pc == end_pc) { @@ -2362,7 +2362,7 @@ tfind_line_command (const char *args, int from_tty) gdb_printf (" but contains no code.\n"); sal = find_sal_for_pc (start_pc, 0); if (sal.line > 0 - && find_line_pc_range (sal, &start_pc, &end_pc) + && find_pc_range_for_sal (sal, &start_pc, &end_pc) && start_pc != end_pc) gdb_printf ("Attempting to find line %ps instead.\n", styled_string (line_number_style.style (), diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 07453b4ea5e..b49a33b8413 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -401,7 +401,7 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) = get_current_source_symtab_and_line (current_program_space); if (sal.symtab != nullptr) - find_line_pc (sal.symtab, sal.line, &addr); + find_pc_for_line (sal.symtab, sal.line, &addr); } if (addr == 0) diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 9485ad96002..4a2f4235273 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -172,7 +172,7 @@ tui_source_window::do_scroll_vertical (int num_to_scroll) line_no = m_start_line_or_addr.u.line_no; cursal.line = line_no; - find_line_pc (cursal.symtab, cursal.line, &cursal.pc); + find_pc_for_line (cursal.symtab, cursal.line, &cursal.pc); for (struct tui_source_window_base *win_info : tui_source_windows ()) win_info->update_source_window_as_is (arch, cursal); } @@ -238,7 +238,7 @@ tui_source_window::display_start_addr (struct gdbarch **gdbarch_p, symtab_and_line cursal = get_current_source_symtab_and_line (current_program_space); *gdbarch_p = m_gdbarch; - find_line_pc (cursal.symtab, m_start_line_or_addr.u.line_no, addr_p); + find_pc_for_line (cursal.symtab, m_start_line_or_addr.u.line_no, addr_p); } /* See tui-winsource.h. */ diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 27f682b7ea8..e6bbe1535a3 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -208,7 +208,7 @@ tui_update_source_windows_with_line (struct symtab_and_line sal) struct gdbarch *gdbarch = nullptr; if (sal.symtab != nullptr) { - find_line_pc (sal.symtab, sal.line, &sal.pc); + find_pc_for_line (sal.symtab, sal.line, &sal.pc); gdbarch = sal.symtab->compunit ()->objfile ()->arch (); }