aboutsummaryrefslogtreecommitdiff
path: root/gdb/windows-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/windows-tdep.c')
-rw-r--r--gdb/windows-tdep.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 05335d2..c6f5803 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -550,43 +550,6 @@ windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
xml += "\"/></library>";
}
-/* Implement the "iterate_over_objfiles_in_search_order" gdbarch
- method. It searches all objfiles, starting with CURRENT_OBJFILE
- first (if not NULL).
-
- On Windows, the system behaves a little differently when two
- objfiles each define a global symbol using the same name, compared
- to other platforms such as GNU/Linux for instance. On GNU/Linux,
- all instances of the symbol effectively get merged into a single
- one, but on Windows, they remain distinct.
-
- As a result, it usually makes sense to start global symbol searches
- with the current objfile before expanding it to all other objfiles.
- This helps for instance when a user debugs some code in a DLL that
- refers to a global variable defined inside that DLL. When trying
- to print the value of that global variable, it would be unhelpful
- to print the value of another global variable defined with the same
- name, but in a different DLL. */
-
-static void
-windows_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile)
-{
- if (current_objfile)
- {
- if (cb (current_objfile))
- return;
- }
-
- for (objfile *objfile : current_program_space->objfiles ())
- if (objfile != current_objfile)
- {
- if (cb (objfile))
- return;
- }
-}
-
static void
show_maint_show_all_tib (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -866,15 +829,20 @@ windows_get_siginfo_type (struct gdbarch *gdbarch)
struct windows_solib_ops : target_solib_ops
{
+ using target_solib_ops::target_solib_ops;
+
void create_inferior_hook (int from_tty) const override;
+ void iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const override;
};
/* Return a new solib_ops for Windows systems. */
static solib_ops_up
-make_windows_solib_ops ()
+make_windows_solib_ops (program_space *pspace)
{
- return std::make_unique<windows_solib_ops> ();
+ return std::make_unique<windows_solib_ops> (pspace);
}
/* Implement the "solib_create_inferior_hook" solib_ops method. */
@@ -925,6 +893,43 @@ windows_solib_ops::create_inferior_hook (int from_tty) const
}
}
+/* Implement the "iterate_over_objfiles_in_search_order" gdbarch
+ method. It searches all objfiles, starting with CURRENT_OBJFILE
+ first (if not NULL).
+
+ On Windows, the system behaves a little differently when two
+ objfiles each define a global symbol using the same name, compared
+ to other platforms such as GNU/Linux for instance. On GNU/Linux,
+ all instances of the symbol effectively get merged into a single
+ one, but on Windows, they remain distinct.
+
+ As a result, it usually makes sense to start global symbol searches
+ with the current objfile before expanding it to all other objfiles.
+ This helps for instance when a user debugs some code in a DLL that
+ refers to a global variable defined inside that DLL. When trying
+ to print the value of that global variable, it would be unhelpful
+ to print the value of another global variable defined with the same
+ name, but in a different DLL. */
+
+void
+windows_solib_ops::iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const
+{
+ if (current_objfile)
+ {
+ if (cb (current_objfile))
+ return;
+ }
+
+ for (objfile *objfile : m_pspace->objfiles ())
+ if (objfile != current_objfile)
+ {
+ if (cb (objfile))
+ return;
+ }
+}
+
/* Common parts for gdbarch initialization for the Windows and Cygwin OS
ABIs. */
@@ -938,9 +943,6 @@ windows_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch)
`c:\Program Files\Foo App\mydll.dll', for example. */
set_gdbarch_has_dos_based_file_system (gdbarch, 1);
- set_gdbarch_iterate_over_objfiles_in_search_order
- (gdbarch, windows_iterate_over_objfiles_in_search_order);
-
set_gdbarch_make_solib_ops (gdbarch, make_windows_solib_ops);
set_gdbarch_get_siginfo_type (gdbarch, windows_get_siginfo_type);
@@ -1160,13 +1162,11 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
ULONGEST
windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
- gdb_byte *readbuf,
+ struct bfd &cbfd, gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
cpms_data data { gdbarch, "<library-list>\n", 0 };
- bfd_map_over_sections (current_program_space->core_bfd (),
- core_process_module_section,
- &data);
+ bfd_map_over_sections (&cbfd, core_process_module_section, &data);
data.xml += "</library-list>\n";
ULONGEST len_avail = data.xml.length ();