1 /* Copyright (C) 2021-2022 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/>. */
20 #include "tui/tui-stack.h"
21 #include "tui/tui-data.h"
22 #include "tui/tui-location.h"
26 /* See tui/tui-location.h. */
28 tui_location_tracker tui_location
;
30 /* See tui/tui-location.h. */
33 tui_location_tracker::set_location (struct gdbarch
*gdbarch
,
34 const struct symtab_and_line
&sal
,
37 gdb_assert (procname
!= nullptr);
39 bool location_changed_p
= set_fullname (sal
.symtab
);
40 location_changed_p
|= procname
!= m_proc_name
;
41 location_changed_p
|= sal
.line
!= m_line_no
;
42 location_changed_p
|= sal
.pc
!= m_addr
;
43 location_changed_p
|= gdbarch
!= m_gdbarch
;
45 m_proc_name
= procname
;
50 if (location_changed_p
)
51 tui_show_locator_content ();
53 return location_changed_p
;
56 /* See tui/tui-location.h. */
59 tui_location_tracker::set_location (struct symtab
*symtab
)
61 bool location_changed_p
= set_fullname (symtab
);
63 if (location_changed_p
)
64 tui_show_locator_content ();
66 return location_changed_p
;
69 /* See tui/tui-location.h. */
72 tui_location_tracker::set_fullname (struct symtab
*symtab
)
74 const char *fullname
= (symtab
== nullptr
76 : symtab_to_fullname (symtab
));
77 bool location_changed_p
= fullname
!= m_full_name
;
78 m_full_name
= std::string (fullname
);
80 return location_changed_p
;