gnulib: define the path to gnulib's parent dir
[binutils-gdb.git] / gdb / solib-svr4.c
index c7b3157191f2e625c65deef6f8b19d8657a0d7f2..a8a7d1171dc6e4b39f88f364d59231b97cfa10bc 100644 (file)
@@ -428,11 +428,14 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
   int pt_phdr_p = 0;
 
   /* Get required auxv elements from target.  */
-  if (target_auxv_search (current_top_target (), AT_PHDR, &at_phdr) <= 0)
+  if (target_auxv_search (current_inferior ()->top_target (),
+                         AT_PHDR, &at_phdr) <= 0)
     return {};
-  if (target_auxv_search (current_top_target (), AT_PHENT, &at_phent) <= 0)
+  if (target_auxv_search (current_inferior ()->top_target (),
+                         AT_PHENT, &at_phent) <= 0)
     return {};
-  if (target_auxv_search (current_top_target (), AT_PHNUM, &at_phnum) <= 0)
+  if (target_auxv_search (current_inferior ()->top_target (),
+                         AT_PHNUM, &at_phnum) <= 0)
     return {};
   if (!at_phdr || !at_phnum)
     return {};
@@ -1239,7 +1242,8 @@ svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list,
 
   /* Fetch the list of shared libraries.  */
   gdb::optional<gdb::char_vector> svr4_library_document
-    = target_read_stralloc (current_top_target (), TARGET_OBJECT_LIBRARIES_SVR4,
+    = target_read_stralloc (current_inferior ()->top_target (),
+                           TARGET_OBJECT_LIBRARIES_SVR4,
                            annex);
   if (!svr4_library_document)
     return 0;
@@ -2015,15 +2019,13 @@ svr4_handle_solib_event (void)
 static bool
 svr4_update_solib_event_breakpoint (struct breakpoint *b)
 {
-  struct bp_location *loc;
-
   if (b->type != bp_shlib_event)
     {
       /* Continue iterating.  */
       return false;
     }
 
-  for (loc = b->loc; loc != NULL; loc = loc->next)
+  for (bp_location *loc : b->locations ())
     {
       struct svr4_info *info;
       struct probe_and_action *pa;
@@ -2057,7 +2059,8 @@ svr4_update_solib_event_breakpoint (struct breakpoint *b)
 static void
 svr4_update_solib_event_breakpoints (void)
 {
-  iterate_over_breakpoints (svr4_update_solib_event_breakpoint);
+  for (breakpoint *bp : all_breakpoints_safe ())
+    svr4_update_solib_event_breakpoint (bp);
 }
 
 /* Create and register solib event breakpoints.  PROBES is an array
@@ -2242,9 +2245,8 @@ enable_break (struct svr4_info *info, int from_tty)
 
       sym_addr = gdbarch_addr_bits_remove
        (target_gdbarch (),
-        gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
-                                            sym_addr,
-                                            current_top_target ()));
+        gdbarch_convert_from_func_ptr_addr
+          (target_gdbarch (), sym_addr, current_inferior ()->top_target ()));
 
       /* On at least some versions of Solaris there's a dynamic relocation
         on _r_debug.r_brk and SYM_ADDR may not be relocated yet, e.g., if
@@ -2353,7 +2355,8 @@ enable_break (struct svr4_info *info, int from_tty)
       /* If we were not able to find the base address of the loader
         from our so_list, then try using the AT_BASE auxilliary entry.  */
       if (!load_addr_found)
-       if (target_auxv_search (current_top_target (), AT_BASE, &load_addr) > 0)
+       if (target_auxv_search (current_inferior ()->top_target (),
+                               AT_BASE, &load_addr) > 0)
          {
            int addr_bit = gdbarch_addr_bit (target_gdbarch ());
 
@@ -2474,9 +2477,8 @@ enable_break (struct svr4_info *info, int from_tty)
          && (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0))
        {
          sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
-         sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
-                                                        sym_addr,
-                                                        current_top_target ());
+         sym_addr = gdbarch_convert_from_func_ptr_addr
+           (target_gdbarch (), sym_addr, current_inferior ()->top_target ());
          svr4_create_solib_event_breakpoints (info, target_gdbarch (),
                                               sym_addr);
          return 1;
@@ -2492,9 +2494,9 @@ enable_break (struct svr4_info *info, int from_tty)
              && (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0))
            {
              sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
-             sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
-                                                            sym_addr,
-                                                            current_top_target ());
+             sym_addr = gdbarch_convert_from_func_ptr_addr
+               (target_gdbarch (), sym_addr,
+                current_inferior ()->top_target ());
              svr4_create_solib_event_breakpoints (info, target_gdbarch (),
                                                   sym_addr);
              return 1;
@@ -2582,7 +2584,8 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
   if ((bfd_get_file_flags (current_program_space->exec_bfd ()) & DYNAMIC) == 0)
     return 0;
 
-  if (target_auxv_search (current_top_target (), AT_ENTRY, &entry_point) <= 0)
+  if (target_auxv_search (current_inferior ()->top_target (),
+                         AT_ENTRY, &entry_point) <= 0)
     return 0;
 
   exec_displacement
@@ -3292,5 +3295,6 @@ _initialize_svr4_solib ()
   svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints;
   svr4_so_ops.handle_event = svr4_handle_solib_event;
 
-  gdb::observers::free_objfile.attach (svr4_free_objfile_observer);
+  gdb::observers::free_objfile.attach (svr4_free_objfile_observer,
+                                      "solib-svr4");
 }