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/>. */
19 #include "tui/tui-status.h"
20 #include "tui/tui-data.h"
21 #include "tui/tui-location.h"
25 /* See tui/tui-location.h. */
27 tui_location_tracker tui_location
;
29 /* See tui/tui-location.h. */
32 tui_location_tracker::set_location (struct gdbarch
*gdbarch
,
33 const struct symtab_and_line
&sal
,
36 gdb_assert (procname
!= nullptr);
38 bool location_changed_p
= set_fullname (sal
.symtab
);
39 location_changed_p
|= procname
!= m_proc_name
;
40 location_changed_p
|= sal
.line
!= m_line_no
;
41 location_changed_p
|= sal
.pc
!= m_addr
;
42 location_changed_p
|= gdbarch
!= m_gdbarch
;
44 m_proc_name
= procname
;
49 if (location_changed_p
)
50 tui_show_status_content ();
52 return location_changed_p
;
55 /* See tui/tui-location.h. */
58 tui_location_tracker::set_location (struct symtab
*symtab
)
60 bool location_changed_p
= set_fullname (symtab
);
62 if (location_changed_p
)
63 tui_show_status_content ();
65 return location_changed_p
;
68 /* See tui/tui-location.h. */
71 tui_location_tracker::set_fullname (struct symtab
*symtab
)
73 const char *fullname
= (symtab
== nullptr
75 : symtab_to_fullname (symtab
));
76 bool location_changed_p
= fullname
!= m_full_name
;
77 m_full_name
= std::string (fullname
);
79 return location_changed_p
;