arm, objdump: print obsolote warning when 26-bit set in instructions
[binutils-gdb.git] / gdb / tui / tui-location.c
blob8e63d4f2c4108b1153fc8255b7d537c6ebf95845
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 #include "tui/tui-status.h"
19 #include "tui/tui-location.h"
20 #include "symtab.h"
21 #include "source.h"
23 /* See tui/tui-location.h. */
25 tui_location_tracker tui_location;
27 /* See tui/tui-location.h. */
29 bool
30 tui_location_tracker::set_location (struct gdbarch *gdbarch,
31 const struct symtab_and_line &sal,
32 const char *procname)
34 gdb_assert (procname != nullptr);
36 bool location_changed_p = set_fullname (sal.symtab);
37 location_changed_p |= procname != m_proc_name;
38 location_changed_p |= sal.line != m_line_no;
39 location_changed_p |= sal.pc != m_addr;
40 location_changed_p |= gdbarch != m_gdbarch;
42 m_proc_name = procname;
43 m_line_no = sal.line;
44 m_addr = sal.pc;
45 m_gdbarch = gdbarch;
47 if (location_changed_p)
48 tui_show_status_content ();
50 return location_changed_p;
53 /* See tui/tui-location.h. */
55 bool
56 tui_location_tracker::set_location (struct symtab *symtab)
58 bool location_changed_p = set_fullname (symtab);
60 if (location_changed_p)
61 tui_show_status_content ();
63 return location_changed_p;
66 /* See tui/tui-location.h. */
68 bool
69 tui_location_tracker::set_fullname (struct symtab *symtab)
71 const char *fullname = (symtab == nullptr
72 ? "??"
73 : symtab_to_fullname (symtab));
74 bool location_changed_p = fullname != m_full_name;
75 m_full_name = std::string (fullname);
77 return location_changed_p;