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"
23 /* See tui/tui-location.h. */
25 tui_location_tracker tui_location
;
27 /* See tui/tui-location.h. */
30 tui_location_tracker::set_location (struct gdbarch
*gdbarch
,
31 const struct symtab_and_line
&sal
,
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
;
47 if (location_changed_p
)
48 tui_show_status_content ();
50 return location_changed_p
;
53 /* See tui/tui-location.h. */
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. */
69 tui_location_tracker::set_fullname (struct symtab
*symtab
)
71 const char *fullname
= (symtab
== nullptr
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
;