More updated translations
[binutils-gdb.git] / gdb / tui / tui-location.h
blob5eda4bde0a66e639da8950e9156001c9e8cc15fd
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 #ifndef GDB_TUI_TUI_LOCATION_H
19 #define GDB_TUI_TUI_LOCATION_H
21 /* Class used to track the current location that the TUI is displaying. An
22 instance of this class will be created; as events occur within GDB the
23 location information within this instance will be updated. As windows
24 like the status window, source window, or disassembler window need to
25 update themselves, they will ask this instance which location they
26 should be displaying. */
28 struct tui_location_tracker
30 /* Update the current location with the provided arguments. Returns
31 true if any of the status window's fields were actually changed,
32 and false otherwise. */
33 bool set_location (struct gdbarch *gdbarch,
34 const struct symtab_and_line &sal,
35 const char *procname);
37 /* Update the current location with the with the provided argument.
38 Return true if any of the fields actually changed, otherwise false. */
39 bool set_location (struct symtab *symtab);
41 /* Return the address of the current location. */
42 CORE_ADDR addr () const
43 { return m_addr; }
45 /* Return the architecture for the current location. */
46 struct gdbarch *gdbarch () const
47 { return m_gdbarch; }
49 /* Return the full name of the file containing the current location. */
50 const std::string &full_name () const
51 { return m_full_name; }
53 /* Return the name of the function containing the current location. */
54 const std::string &proc_name () const
55 { return m_proc_name; }
57 /* Return the line number for the current location. */
58 int line_no () const
59 { return m_line_no; }
61 private:
63 /* Update M_FULL_NAME from SYMTAB. Return true if M_FULL_NAME actually
64 changed, otherwise, return false. */
65 bool set_fullname (struct symtab *symtab);
67 /* The full name for the file containing the current location. */
68 std::string m_full_name;
70 /* The name of the function we're currently within. */
71 std::string m_proc_name;
73 /* The line number for the current location. */
74 int m_line_no = 0;
76 /* The address of the current location. */
77 CORE_ADDR m_addr = 0;
79 /* Architecture associated with code at this location. */
80 struct gdbarch *m_gdbarch = nullptr;
83 /* The single global instance of the location tracking class. Tracks the
84 current location that the TUI windows are displaying. */
86 extern tui_location_tracker tui_location;
88 #endif /* GDB_TUI_TUI_LOCATION_H */