public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix failure in gdb.ada/complete.exp
@ 2019-05-29 17:24 sergiodj+buildbot
  2019-05-29 17:37 ` *** COMPILATION FAILED *** Failures on Solaris11-sparcv9-m64, branch master *** BREAKAGE *** sergiodj+buildbot
                   ` (14 more replies)
  0 siblings, 15 replies; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 17:24 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT f49055a52f04f75b6560f304eb975128dd82ad68 ***

Author: Tom Tromey <tromey@adacore.com>
Branch: master
Commit: f49055a52f04f75b6560f304eb975128dd82ad68

Fix failure in gdb.ada/complete.exp

I noticed a failure in gdb.ada/complete.exp when testing locally:

    FAIL: gdb.ada/complete.exp: complete break ada

This failed due to this output:

    [...]
    break ada/generated/gnatvsn.ads
    break ada/libgnat/s-excmac.ads
    break ada/sdefault.adb
    break ada/snames.adb
    break ada/snames.ads

This patch updates the regexp to allow "/" and "-" to appear.

gdb/testsuite/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/complete.exp (test_gdb_no_completion): Add "/" and "-"
	to "break complete ada" test case's regexp.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Remove the TUI annotation hack
@ 2020-02-24  3:04 gdb-buildbot
  2020-02-24  5:01 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2020-02-24  3:04 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT fc96d20b2c6d7ff24349ad015119438077d3f1e9 ***

commit fc96d20b2c6d7ff24349ad015119438077d3f1e9
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Sat Feb 22 11:48:26 2020 -0700
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Sat Feb 22 11:48:39 2020 -0700

    Remove the TUI annotation hack
    
    do_tui_putc has some code to remove annotations from gdb output.  This
    was added in 2001, see commit a198b876bbcb.
    
    However, I think this code is not needed.  It seems very unlikely to
    enable both annotations and the TUI, and in any case I think this is
    something that should not be supported.
    
    So, this patch removes this code.
    
    gdb/ChangeLog
    2020-02-22  Tom Tromey  <tom@tromey.com>
    
            * tui/tui-io.c (do_tui_putc): Don't omit annotations.
    
    Change-Id: I05728110365a362d37c9821df9c8779316100bb8

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 474825b095..718e500507 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-02-22  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-io.c (do_tui_putc): Don't omit annotations.
+
 2020-02-22  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index d9f23334f5..b5ee2a2b6b 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -138,35 +138,21 @@ static int tui_readline_pipe[2];
 static void
 do_tui_putc (WINDOW *w, char c)
 {
-  static int tui_skip_line = -1;
-
-  /* Catch annotation and discard them.  We need two \032 and discard
-     until a \n is seen.  */
-  if (c == '\032')
-    {
-      tui_skip_line++;
-    }
-  else if (tui_skip_line != 1)
+  /* Expand TABs, since ncurses on MS-Windows doesn't.  */
+  if (c == '\t')
     {
-      tui_skip_line = -1;
-      /* Expand TABs, since ncurses on MS-Windows doesn't.  */
-      if (c == '\t')
-	{
-	  int col;
+      int col;
 
-	  col = getcurx (w);
-	  do
-	    {
-	      waddch (w, ' ');
-	      col++;
-	    }
-	  while ((col % 8) != 0);
+      col = getcurx (w);
+      do
+	{
+	  waddch (w, ' ');
+	  col++;
 	}
-      else
-	waddch (w, c);
+      while ((col % 8) != 0);
     }
-  else if (c == '\n')
-    tui_skip_line = -1;
+  else
+    waddch (w, c);
 }
 
 /* Update the cached value of the command window's start line based on


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Remove tui_set_win_with_focus
@ 2020-02-24  2:28 gdb-buildbot
  2020-02-24  3:36 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2020-02-24  2:28 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 935c78c0468215e2f034f39b8285fa8bb17729b8 ***

commit 935c78c0468215e2f034f39b8285fa8bb17729b8
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Sat Feb 22 11:48:26 2020 -0700
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Sat Feb 22 11:48:38 2020 -0700

    Remove tui_set_win_with_focus
    
    I noticed that the TUI had two functions with similar names:
    tui_set_win_focus_to and tui_set_win_with_focus.
    
    However, one was just an implementation detail of the latter.  So,
    this patch removes tui_set_win_with_focus entirely, to avoid any
    temptation to call it.
    
    gdb/ChangeLog
    2020-02-22  Tom Tromey  <tom@tromey.com>
    
            * tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
            * tui/tui-data.h (tui_set_win_with_focus): Don't declare.
            * tui/tui-data.c (tui_set_win_with_focus): Remove.
            (tui_set_win_focus_to): Move from tui-win.c.
    
    Change-Id: Idffddab773436bdf80d55480906d76b292981ef2

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fe86927826..474825b095 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2020-02-22  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
+	* tui/tui-data.h (tui_set_win_with_focus): Don't declare.
+	* tui/tui-data.c (tui_set_win_with_focus): Remove.
+	(tui_set_win_focus_to): Move from tui-win.c.
+
 2020-02-22  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui-layout.c (make_standard_window, get_locator_window): New
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index db637d8fbe..8f7d257e94 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -23,6 +23,7 @@
 #include "symtab.h"
 #include "tui/tui.h"
 #include "tui/tui-data.h"
+#include "tui/tui-win.h"
 #include "tui/tui-wingeneral.h"
 #include "tui/tui-winsource.h"
 #include "gdb_curses.h"
@@ -59,11 +60,16 @@ tui_win_with_focus (void)
 }
 
 
-/* Set the window that has the logical focus.  */
+/* Set the logical focus to win_info.  */
 void
-tui_set_win_with_focus (struct tui_win_info *win_info)
+tui_set_win_focus_to (struct tui_win_info *win_info)
 {
-  win_with_focus = win_info;
+  if (win_info != NULL)
+    {
+      tui_unhighlight_win (win_with_focus);
+      win_with_focus = win_info;
+      tui_highlight_win (win_info);
+    }
 }
 
 
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 51208b1100..60c588ed15 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -251,7 +251,6 @@ extern int tui_term_width (void);
 extern void tui_set_term_width_to (int);
 extern struct tui_locator_window *tui_locator_win_info_ptr (void);
 extern struct tui_win_info *tui_win_with_focus (void);
-extern void tui_set_win_with_focus (struct tui_win_info *);
 extern bool tui_win_resized ();
 extern void tui_set_win_resized_to (bool);
 
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index ac314d7d2a..51d0365b72 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -452,21 +452,6 @@ tui_update_gdb_sizes (void)
 }
 
 
-/* Set the logical focus to win_info.  */
-void
-tui_set_win_focus_to (struct tui_win_info *win_info)
-{
-  if (win_info != NULL)
-    {
-      struct tui_win_info *win_with_focus = tui_win_with_focus ();
-
-      tui_unhighlight_win (win_with_focus);
-      tui_set_win_with_focus (win_info);
-      tui_highlight_win (win_info);
-    }
-}
-
-
 void
 tui_win_info::forward_scroll (int num_to_scroll)
 {


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Change how TUI windows are instantiated
@ 2020-02-24  2:28 gdb-buildbot
  2020-02-24  3:35 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2020-02-24  2:28 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 0240c8f11b06a33a043bacbe2b9e723ae6ad573c ***

commit 0240c8f11b06a33a043bacbe2b9e723ae6ad573c
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Sat Feb 22 11:48:26 2020 -0700
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Sat Feb 22 11:48:38 2020 -0700

    Change how TUI windows are instantiated
    
    This adds a new global that maps from window names to window
    constructor functions, and then changes tui_get_window_by_name and
    validate_window_name to use it.  This is another step toward
    user-defined window types.
    
    gdb/ChangeLog
    2020-02-22  Tom Tromey  <tom@tromey.com>
    
            * tui/tui-layout.c (make_standard_window, get_locator_window): New
            functions.
            (known_window_types): New global.
            (tui_get_window_by_name): Reimplement.
            (initialize_known_windows): New function.
            (validate_window_name): Rewrite.
            (_initialize_tui_layout): Call initialize_known_windows.
    
    Change-Id: I9037aac550299b9d945899220a30c2d3af9dd0de

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dc54fc40e6..fe86927826 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2020-02-22  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-layout.c (make_standard_window, get_locator_window): New
+	functions.
+	(known_window_types): New global.
+	(tui_get_window_by_name): Reimplement.
+	(initialize_known_windows): New function.
+	(validate_window_name): Rewrite.
+	(_initialize_tui_layout): Call initialize_known_windows.
+
 2020-02-22  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui.h (enum tui_win_type) <LOCATOR_WIN, DATA_ITEM_WIN>:
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index c27a8d086e..748a106729 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -29,6 +29,7 @@
 #include "cli/cli-decode.h"
 #include "cli/cli-utils.h"
 #include <ctype.h>
+#include <unordered_map>
 #include <unordered_set>
 
 #include "tui/tui.h"
@@ -322,40 +323,74 @@ tui_gen_win_info::resize (int height_, int width_,
 
 \f
 
+/* Helper function to create one of the built-in (non-locator)
+   windows.  */
+
+template<enum tui_win_type V, class T>
+static tui_gen_win_info *
+make_standard_window (const char *)
+{
+  if (tui_win_list[V] == nullptr)
+    tui_win_list[V] = new T ();
+  return tui_win_list[V];
+}
+
+/* Helper function to wrap tui_locator_win_info_ptr for
+   tui_get_window_by_name.  */
+
+static tui_gen_win_info *
+get_locator_window (const char *)
+{
+  return tui_locator_win_info_ptr ();
+}
+
+/* A map holding all the known window types, keyed by name.  Note that
+   this is heap-allocated and "leaked" at gdb exit.  This avoids
+   ordering issues with destroying elements in the map at shutdown.
+   In particular, destroying this map can occur after Python has been
+   shut down, causing crashes if any window destruction requires
+   running Python code.  */
+
+static std::unordered_map<std::string, window_factory> *known_window_types;
+
 /* Helper function that returns a TUI window, given its name.  */
 
 static tui_gen_win_info *
 tui_get_window_by_name (const std::string &name)
 {
-  if (name == "src")
-    {
-      if (tui_win_list[SRC_WIN] == nullptr)
-	tui_win_list[SRC_WIN] = new tui_source_window ();
-      return tui_win_list[SRC_WIN];
-    }
-  else if (name == "cmd")
-    {
-      if (tui_win_list[CMD_WIN] == nullptr)
-	tui_win_list[CMD_WIN] = new tui_cmd_window ();
-      return tui_win_list[CMD_WIN];
-    }
-  else if (name == "regs")
-    {
-      if (tui_win_list[DATA_WIN] == nullptr)
-	tui_win_list[DATA_WIN] = new tui_data_window ();
-      return tui_win_list[DATA_WIN];
-    }
-  else if (name == "asm")
-    {
-      if (tui_win_list[DISASSEM_WIN] == nullptr)
-	tui_win_list[DISASSEM_WIN] = new tui_disasm_window ();
-      return tui_win_list[DISASSEM_WIN];
-    }
-  else
-    {
-      gdb_assert (name == "status");
-      return tui_locator_win_info_ptr ();
-    }
+  for (tui_win_info *window : saved_tui_windows)
+    if (name == window->name ())
+      return window;
+
+  auto iter = known_window_types->find (name);
+  if (iter == known_window_types->end ())
+    error (_("Unknown window type \"%s\""), name.c_str ());
+
+  tui_gen_win_info *result = iter->second (name.c_str ());
+  if (result == nullptr)
+    error (_("Could not create window \"%s\""), name.c_str ());
+  return result;
+}
+
+/* Initialize the known window types.  */
+
+static void
+initialize_known_windows ()
+{
+  known_window_types = new std::unordered_map<std::string, window_factory>;
+
+  known_window_types->emplace ("src",
+			       make_standard_window<SRC_WIN,
+						    tui_source_window>);
+  known_window_types->emplace ("cmd",
+			       make_standard_window<CMD_WIN, tui_cmd_window>);
+  known_window_types->emplace ("regs",
+			       make_standard_window<DATA_WIN,
+						    tui_data_window>);
+  known_window_types->emplace ("asm",
+			       make_standard_window<DISASSEM_WIN,
+						    tui_disasm_window>);
+  known_window_types->emplace ("status", get_locator_window);
 }
 
 /* See tui-layout.h.  */
@@ -886,9 +921,8 @@ initialize_layouts ()
 static bool
 validate_window_name (const std::string &name)
 {
-  return (name == "src" || name == "cmd"
-	  || name == "regs" || name == "asm"
-	  || name == "status");
+  auto iter = known_window_types->find (name);
+  return iter != known_window_types->end ();
 }
 
 /* Implementation of the "tui new-layout" command.  */
@@ -1023,4 +1057,5 @@ to be allocated to the window."),
 	   tui_get_cmd_list ());
 
   initialize_layouts ();
+  initialize_known_windows ();
 }


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Move free_all_objfiles to program_space
@ 2019-12-13  1:00 gdb-buildbot
  2019-12-13  1:19 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-12-13  1:00 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 343cc95202fce70383551053f2efab09c5e02366 ***

commit 343cc95202fce70383551053f2efab09c5e02366
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Fri Nov 1 21:02:38 2019 -0600
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Thu Dec 12 15:50:56 2019 -0700

    Move free_all_objfiles to program_space
    
    This changes free_all_objfiles to be a method on program_space, in
    line with the other changes to treat program_space as a container for
    objfiles.
    
    gdb/ChangeLog
    2019-12-12  Tom Tromey  <tom@tromey.com>
    
            * symfile.c (symbol_file_clear): Update.
            * progspace.h (struct program_space) <free_all_objfiles>: Declare
            method.
            * progspace.c (program_space::free_all_objfiles): New method.
            * objfiles.h (free_all_objfiles): Don't declare.
            * objfiles.c (free_all_objfiles): Move to program_space.
    
    Change-Id: I908b549d2981b6005f7ca181fc0e6d24fc8b7b6f

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9b96f3d8fd..9c1322d2a0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2019-12-12  Tom Tromey  <tom@tromey.com>
+
+	* symfile.c (symbol_file_clear): Update.
+	* progspace.h (struct program_space) <free_all_objfiles>: Declare
+	method.
+	* progspace.c (program_space::free_all_objfiles): New method.
+	* objfiles.h (free_all_objfiles): Don't declare.
+	* objfiles.c (free_all_objfiles): Move to program_space.
+
 2019-12-12  Tom Tromey  <tom@tromey.com>
 
 	* progspace.c (program_space::add_objfile)
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 31265c1653..56854cc5c6 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -618,21 +618,6 @@ objfile::~objfile ()
   get_objfile_pspace_data (pspace)->section_map_dirty = 1;
 }
 
-/* Free all the object files at once and clean up their users.  */
-
-void
-free_all_objfiles (void)
-{
-  struct so_list *so;
-
-  /* Any objfile reference would become stale.  */
-  for (so = master_so_list (); so; so = so->next)
-    gdb_assert (so->objfile == NULL);
-
-  for (objfile *objfile : current_program_space->objfiles_safe ())
-    objfile->unlink ();
-  clear_symtab_users (0);
-}
 \f
 /* A helper function for objfile_relocate1 that relocates a single
    symbol.  */
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index f9bf102bc8..34240558da 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -662,8 +662,6 @@ extern void build_objfile_section_table (struct objfile *);
 
 extern void free_objfile_separate_debug (struct objfile *);
 
-extern void free_all_objfiles (void);
-
 extern void objfile_relocate (struct objfile *, const struct section_offsets *);
 extern void objfile_rebase (struct objfile *, CORE_ADDR);
 
diff --git a/gdb/progspace.c b/gdb/progspace.c
index d1bf0c6aba..3cb0d4c61e 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -23,6 +23,7 @@
 #include "arch-utils.h"
 #include "gdbcore.h"
 #include "solib.h"
+#include "solist.h"
 #include "gdbthread.h"
 #include "inferior.h"
 #include <algorithm>
@@ -156,6 +157,23 @@ program_space::~program_space ()
 
 /* See progspace.h.  */
 
+void
+program_space::free_all_objfiles ()
+{
+  struct so_list *so;
+
+  /* Any objfile reference would become stale.  */
+  for (so = master_so_list (); so; so = so->next)
+    gdb_assert (so->objfile == NULL);
+
+  while (!objfiles_list.empty ())
+    objfiles_list.front ()->unlink ();
+
+  clear_symtab_users (0);
+}
+
+/* See progspace.h.  */
+
 void
 program_space::add_objfile (struct objfile *objfile, struct objfile *before)
 {
diff --git a/gdb/progspace.h b/gdb/progspace.h
index a731eb6e24..6945e38eb9 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -179,6 +179,9 @@ struct program_space
     return objfiles_list.size () > 1;
   }
 
+  /* Free all the objfiles associated with this program space.  */
+  void free_all_objfiles ();
+
 
   /* Pointer to next in linked list.  */
   struct program_space *next = NULL;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 965237191a..8852e2893a 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1251,7 +1251,7 @@ symbol_file_clear (int from_tty)
      objfiles get stale by free_all_objfiles.  */
   no_shared_libraries (NULL, from_tty);
 
-  free_all_objfiles ();
+  current_program_space->free_all_objfiles ();
 
   gdb_assert (symfile_objfile == NULL);
   if (from_tty)


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Store objfiles on a std::list
@ 2019-12-13  0:56 gdb-buildbot
  2019-12-13  1:17 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-12-13  0:56 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT d0801dd8f22a3e739c6a7d126d45829df981794d ***

commit d0801dd8f22a3e739c6a7d126d45829df981794d
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Sun Mar 10 06:56:33 2019 -0600
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Thu Dec 12 15:50:55 2019 -0700

    Store objfiles on a std::list
    
    This removes objfile::next and changes objfiles to be stored in a
    std::list.
    
    gdb/ChangeLog
    2019-12-12  Tom Tromey  <tom@tromey.com>
    
            * progspace.c (program_space::add_objfile)
            (program_space::remove_objfile): Update.
            (program_space::multi_objfile_p): Remove.
            * objfiles.h (struct objfile) <next>: Remove.
            * objfiles.c (objfile::objfile): Update.
            (put_objfile_before): Update.
            (unlink_objfile): Update.
            * progspace.h (object_files): Remove.
            (struct program_space) <objfiles_head>: Remove.
            <objfiles_list>: New member.
            <objfiles_range, objfiles_safe_range>: Change type.
            (objfiles): Change return type.
            (objfiles_safe): Update.
            (multi_objfile_p): Rewrite and inline.
            (object_files): Remove macro.
    
    Change-Id: Ib4430e3db6f9a390399924379a5c10426c514853

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 368d7f0231..9b96f3d8fd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,21 @@
+2019-12-12  Tom Tromey  <tom@tromey.com>
+
+	* progspace.c (program_space::add_objfile)
+	(program_space::remove_objfile): Update.
+	(program_space::multi_objfile_p): Remove.
+	* objfiles.h (struct objfile) <next>: Remove.
+	* objfiles.c (objfile::objfile): Update.
+	(put_objfile_before): Update.
+	(unlink_objfile): Update.
+	* progspace.h (object_files): Remove.
+	(struct program_space) <objfiles_head>: Remove.
+	<objfiles_list>: New member.
+	<objfiles_range, objfiles_safe_range>: Change type.
+	(objfiles): Change return type.
+	(objfiles_safe): Update.
+	(multi_objfile_p): Rewrite and inline.
+	(object_files): Remove macro.
+
 2019-12-12  Tom Tromey  <tom@tromey.com>
 
 	* gdbsupport/safe-iterator.h (basic_safe_iterator): Simplify.  Add
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 34f6a29387..31265c1653 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -54,6 +54,7 @@
 #include "btrace.h"
 #include "gdbsupport/pathstuff.h"
 
+#include <algorithm>
 #include <vector>
 
 /* Keep a registry of per-objfile data-pointers required by other GDB
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 0656cfe4a1..f9bf102bc8 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -486,12 +486,6 @@ public:
   }
 
 
-  /* All struct objfile's are chained together by their next pointers.
-     The program space field "objfiles"  (frequently referenced via
-     the macro "object_files") points to the first link in this chain.  */
-
-  struct objfile *next = nullptr;
-
   /* The object file's original name as specified by the user,
      made absolute, and tilde-expanded.  However, it is not canonicalized
      (i.e., it has not been passed through gdb_realpath).
diff --git a/gdb/progspace.c b/gdb/progspace.c
index a39b34c923..d1bf0c6aba 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -25,6 +25,7 @@
 #include "solib.h"
 #include "gdbthread.h"
 #include "inferior.h"
+#include <algorithm>
 
 /* The last program space number assigned.  */
 int last_program_space_num = 0;
@@ -158,21 +159,15 @@ program_space::~program_space ()
 void
 program_space::add_objfile (struct objfile *objfile, struct objfile *before)
 {
-  for (struct objfile **objp = &objfiles_head;
-       *objp != NULL;
-       objp = &((*objp)->next))
+  if (before == nullptr)
+    objfiles_list.push_back (objfile);
+  else
     {
-      if (*objp == before)
-	{
-	  objfile->next = *objp;
-	  *objp = objfile;
-	  return;
-	}
+      auto iter = std::find (objfiles_list.begin (), objfiles_list.end (),
+			     before);
+      gdb_assert (iter != objfiles_list.end ());
+      objfiles_list.insert (iter, objfile);
     }
-
-  internal_error (__FILE__, __LINE__,
-		  _("put_objfile_before: before objfile not in list"));
-
 }
 
 /* See progspace.h.  */
@@ -180,32 +175,13 @@ program_space::add_objfile (struct objfile *objfile, struct objfile *before)
 void
 program_space::remove_objfile (struct objfile *objfile)
 {
-  struct objfile **objpp;
-
-  for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
-    {
-      if (*objpp == objfile)
-	{
-	  *objpp = (*objpp)->next;
-	  objfile->next = NULL;
-
-	  if (objfile == symfile_object_file)
-	    symfile_object_file = NULL;
+  auto iter = std::find (objfiles_list.begin (), objfiles_list.end (),
+			 objfile);
+  gdb_assert (iter != objfiles_list.end ());
+  objfiles_list.erase (iter);
 
-	  return;
-	}
-    }
-
-  internal_error (__FILE__, __LINE__,
-		  _("remove_objfile: objfile already unlinked"));
-}
-
-/* See progspace.h.  */
-
-bool
-program_space::multi_objfile_p () const
-{
-  return objfiles_head != nullptr && objfiles_head->next != nullptr;
+  if (objfile == symfile_object_file)
+    symfile_object_file = NULL;
 }
 
 /* Copies program space SRC to DEST.  Copies the main executable file,
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 86bc22acc2..a731eb6e24 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -27,6 +27,7 @@
 #include "registry.h"
 #include "gdbsupport/next-iterator.h"
 #include "gdbsupport/safe-iterator.h"
+#include <list>
 
 struct target_ops;
 struct bfd;
@@ -138,20 +139,18 @@ struct program_space
   program_space (address_space *aspace_);
   ~program_space ();
 
-  typedef next_adapter<struct objfile> objfiles_range;
+  typedef std::list<struct objfile *> objfiles_range;
 
   /* Return an iterable object that can be used to iterate over all
      objfiles.  The basic use is in a foreach, like:
 
      for (objfile *objf : pspace->objfiles ()) { ... }  */
-  objfiles_range objfiles ()
+  objfiles_range &objfiles ()
   {
-    return objfiles_range (objfiles_head);
+    return objfiles_list;
   }
 
-  typedef next_adapter<struct objfile,
-		       basic_safe_iterator<next_iterator<objfile>>>
-    objfiles_safe_range;
+  typedef basic_safe_range<objfiles_range> objfiles_safe_range;
 
   /* An iterable object that can be used to iterate over all objfiles.
      The basic use is in a foreach, like:
@@ -162,7 +161,7 @@ struct program_space
      deleted during iteration.  */
   objfiles_safe_range objfiles_safe ()
   {
-    return objfiles_safe_range (objfiles_head);
+    return objfiles_safe_range (objfiles_list);
   }
 
   /* Add OBJFILE to the list of objfiles, putting it just before
@@ -175,7 +174,10 @@ struct program_space
 
   /* Return true if there is more than one object file loaded; false
      otherwise.  */
-  bool multi_objfile_p () const;
+  bool multi_objfile_p () const
+  {
+    return objfiles_list.size () > 1;
+  }
 
 
   /* Pointer to next in linked list.  */
@@ -228,9 +230,8 @@ struct program_space
      (e.g. the argument to the "symbol-file" or "file" command).  */
   struct objfile *symfile_object_file = NULL;
 
-  /* All known objfiles are kept in a linked list.  This points to
-     the head of this list.  */
-  struct objfile *objfiles_head = NULL;
+  /* All known objfiles are kept in a linked list.  */
+  std::list<struct objfile *> objfiles_list;
 
   /* The set of target sections matching the sections mapped into
      this program space.  Managed by both exec_ops and solib.c.  */
@@ -271,10 +272,6 @@ struct address_space
 
 #define symfile_objfile current_program_space->symfile_object_file
 
-/* All known objfiles are kept in a linked list.  This points to the
-   root of this list.  */
-#define object_files current_program_space->objfiles_head
-
 /* The set of target sections matching the sections mapped into the
    current program space.  */
 #define current_target_sections (&current_program_space->target_sections)


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Fix unused function error
@ 2019-12-12 12:19 gdb-buildbot
  2019-12-12 12:24 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-12-12 12:19 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 39f34d7b64ee76e07b82a3e57800905d249d8005 ***

commit 39f34d7b64ee76e07b82a3e57800905d249d8005
Author:     Luis Machado <luis.machado@linaro.org>
AuthorDate: Wed Dec 11 11:55:49 2019 -0300
Commit:     Luis Machado <luis.machado@linaro.org>
CommitDate: Thu Dec 12 09:12:02 2019 -0300

    Fix unused function error
    
    Attempting to build GDB in Ubuntu 16.04.6 LTS on x86_64, I ran into warnings
    that caused the build to fail:
    
    binutils-gdb/gdb/gdbsupport/safe-strerror.c:44:1: error: char* select_strerror_r(char*, char*) defined but not used [-Werror=unused-function]  select_strerror_r (char *res, char *)
    
    The diagnostic macro DIAGNOSTIC_IGNORE_UNUSED_FUNCTION seems to expand
    correctly to its respective pragma, but this doesn't seem to have an effect on
    the warning. I tried to use the pragma explicitly and got the same result.
    
    ATTRIBUTE_UNUSED works fine in this case if you put it in both functions,
    which should fix warnings for both gdb and gdbserver builds.
    
    The compiler version is gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609.
    
    This is likely the result of PR64079 in GCC, which was fixed by commit
    9e96f1e1b9731c4e1ef4fbbbf0997319973f0537.
    
    To prevent other developers from attempting to use this macro, only to get
    confused by it not working as expected, it seems better to not define this
    particular macro.
    
    gdb/ChangeLog:
    
    2019-12-12  Luis Machado  <luis.machado@linaro.org>
    
            * gdbsupport/safe-strerror.c: Don't include diagnostics.h.
            (select_strerror_r): Use ATTRIBUTE_UNUSED instead of the diagnostics
            macros.
    
    include/ChangeLog:
    
    2019-12-12  Luis Machado  <luis.machado@linaro.org>
    
            * diagnostics.h (DIAGNOSTIC_IGNORE_UNUSED_FUNCTION). Remove
            definitions.
    
    Change-Id: Iad6123d61d76d111e3ef8d24aa8c60112304c749

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c80c540351..5ac4f9cb95 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-12  Luis Machado  <luis.machado@linaro.org>
+
+	* gdbsupport/safe-strerror.c: Don't include diagnostics.h.
+	(select_strerror_r): Use ATTRIBUTE_UNUSED instead of the diagnostics
+	macros.
+
 2019-12-11  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui-win.c (tui_set_win_height_command): Call
diff --git a/gdb/gdbsupport/safe-strerror.c b/gdb/gdbsupport/safe-strerror.c
index 9973fa6785..a5ddf74835 100644
--- a/gdb/gdbsupport/safe-strerror.c
+++ b/gdb/gdbsupport/safe-strerror.c
@@ -18,7 +18,6 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "common-defs.h"
-#include "diagnostics.h"
 #include <string.h>
 
 /* There are two different versions of strerror_r; one is GNU-specific, the
@@ -27,27 +26,20 @@
    to solve this for us because IPA does not use Gnulib but uses this
    function.  */
 
-/* We only ever use one of the two overloads, so suppress the warning for
-   an unused function.  */
-DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
-
 /* Called if we have a XSI-compliant strerror_r.  */
-static char *
+ATTRIBUTE_UNUSED static char *
 select_strerror_r (int res, char *buf)
 {
   return res == 0 ? buf : nullptr;
 }
 
 /* Called if we have a GNU strerror_r.  */
-static char *
+ATTRIBUTE_UNUSED static char *
 select_strerror_r (char *res, char *)
 {
   return res;
 }
 
-DIAGNOSTIC_POP
-
 /* Implementation of safe_strerror as defined in common-utils.h.  */
 
 const char *
diff --git a/include/ChangeLog b/include/ChangeLog
index 52cdc0407c..1444cc9146 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-12  Luis Machado  <luis.machado@linaro.org>
+
+	* diagnostics.h (DIAGNOSTIC_IGNORE_UNUSED_FUNCTION). Remove
+	definitions.
+
 2019-12-11  Alan Modra  <amodra@gmail.com>
 
 	* opcode/mmix.h (PUSHGO_INSN_BYTE): Make unsigned.
diff --git a/include/diagnostics.h b/include/diagnostics.h
index 2adaa4d3a0..019ade2567 100644
--- a/include/diagnostics.h
+++ b/include/diagnostics.h
@@ -53,8 +53,6 @@
   DIAGNOSTIC_IGNORE ("-Wdeprecated-declarations")
 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
   DIAGNOSTIC_IGNORE ("-Wdeprecated-register")
-# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
-  DIAGNOSTIC_IGNORE ("-Wunused-function")
 # if __has_warning ("-Wenum-compare-switch")
 #  define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \
    DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
@@ -65,9 +63,6 @@
 
 #elif defined (__GNUC__) /* GCC */
 
-# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
-  DIAGNOSTIC_IGNORE ("-Wunused-function")
-
 # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
   DIAGNOSTIC_IGNORE ("-Wstringop-truncation")
 
@@ -88,10 +83,6 @@
 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
 #endif
 
-#ifndef DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
-# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
-#endif
-
 #ifndef DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
 #endif


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Replace the remaining uses of strerror with safe_strerror
@ 2019-12-10 19:28 gdb-buildbot
  2019-12-10 19:31 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-12-10 19:28 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT ab7d13f07027e6232a21448ef51f0a52a96738a9 ***

commit ab7d13f07027e6232a21448ef51f0a52a96738a9
Author:     Christian Biesinger <cbiesinger@google.com>
AuthorDate: Wed Nov 6 13:57:52 2019 -0600
Commit:     Christian Biesinger <cbiesinger@google.com>
CommitDate: Tue Dec 10 13:23:01 2019 -0600

    Replace the remaining uses of strerror with safe_strerror
    
    To do that, this patch makes IPA compile safe-strerror as well. Because
    it doesn't use Gnulib, it calls the Glibc version of strerror_r directly.
    
    Consequently this patch also removes the configure checks for strerror.
    
    gdb/ChangeLog:
    
    2019-12-10  Christian Biesinger  <cbiesinger@google.com>
    
            * config.in: Regenerate.
            * configure: Regenerate.
            * gdbsupport/agent.c (gdb_connect_sync_socket): Call
            safe_strerror instead of strerror.
            * gdbsupport/common.m4: Don't check for strerror.
            * gdbsupport/safe-strerror.c: Support both the glibc version
            of strerror_r and the XSI version.
    
    gdb/gdbserver/ChangeLog:
    
    2019-12-10  Christian Biesinger  <cbiesinger@google.com>
    
            * Makefile.in: Add safe-strerror.c to gdbreplay and IPA, and change
            UNDO_GNULIB_CFLAGS to undo strerror_r instead of strerror.
            * config.in: Regenerate.
            * configure: Regenerate.
            * configure.ac: Don't check for strerror.
            * linux-i386-ipa.c (initialize_fast_tracepoint_trampoline_buffer):
            Call safe_strerror instead of strerror.
            * server.h (strerror): Remove this now-unnecessary declaration.
            * tracepoint.c (init_named_socket): Call safe_strerror instead of
            strerror.
            (gdb_agent_helper_thread): Likewise.
            * utils.c (perror_with_name): Likewise.
    
    Change-Id: I74848f072dcde75cb55c435ef9398dc8f958cd73

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ac58517ce1..a6e299d905 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2019-12-10  Christian Biesinger  <cbiesinger@google.com>
+
+	* config.in: Regenerate.
+	* configure: Regenerate.
+	* gdbsupport/agent.c (gdb_connect_sync_socket): Call
+	safe_strerror instead of strerror.
+	* gdbsupport/common.m4: Don't check for strerror.
+	* gdbsupport/safe-strerror.c: Support both the glibc version
+	of strerror_r and the XSI version.
+
 2019-12-10  Tom Tromey  <tromey@adacore.com>
 
 	* ada-typeprint.c (print_choices): Use a single "?".
diff --git a/gdb/config.in b/gdb/config.in
index 1caf76481b..cb886ba8e1 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -117,10 +117,6 @@
    don't. */
 #undef HAVE_DECL_SNPRINTF
 
-/* Define to 1 if you have the declaration of `strerror', and to 0 if you
-   don't. */
-#undef HAVE_DECL_STRERROR
-
 /* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
    */
 #undef HAVE_DECL_STRSTR
diff --git a/gdb/configure b/gdb/configure
index 6b64619df7..324eb50944 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -13630,17 +13630,7 @@ fi
 done
 
 
-  ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strerror" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRERROR $ac_have_decl
-_ACEOF
-ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
+  ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strstr" = xyes; then :
   ac_have_decl=1
 else
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index de6c311e07..36dece6172 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,18 @@
+2019-12-10  Christian Biesinger  <cbiesinger@google.com>
+
+	* Makefile.in: Add safe-strerror.c to gdbreplay and IPA, and change
+	UNDO_GNULIB_CFLAGS to undo strerror_r instead of strerror.
+	* config.in: Regenerate.
+	* configure: Regenerate.
+	* configure.ac: Don't check for strerror.
+	* linux-i386-ipa.c (initialize_fast_tracepoint_trampoline_buffer):
+	Call safe_strerror instead of strerror.
+	* server.h (strerror): Remove this now-unnecessary declaration.
+	* tracepoint.c (init_named_socket): Call safe_strerror instead of
+	strerror.
+	(gdb_agent_helper_thread): Likewise.
+	* utils.c (perror_with_name): Likewise.
+
 2019-11-26  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index e79d24f96f..10e004039f 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -304,6 +304,7 @@ GDBREPLAY_OBS = \
 	gdbsupport/errors.o \
 	gdbsupport/netstuff.o \
 	gdbsupport/print-utils.o \
+	gdbsupport/safe-strerror.o \
 	gdbreplay.o \
 	utils.o \
 	version.o
@@ -430,6 +431,7 @@ IPA_OBJS = \
 	gdbsupport/format-ipa.o \
 	gdbsupport/print-utils-ipa.o \
 	gdbsupport/rsp-low-ipa.o \
+	gdbsupport/safe-strerror-ipa.o \
 	gdbsupport/tdesc-ipa.o \
 	regcache-ipa.o \
 	remote-utils-ipa.o \
@@ -557,7 +559,7 @@ UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
 # Undo gnulib replacements for the IPA shared library build.
 # The gnulib headers are still needed, but gnulib is not linked
 # into the IPA lib so replacement apis don't work.
-UNDO_GNULIB_CFLAGS = -Drpl_strerror=strerror
+UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r
 
 # Note, we only build the IPA if -fvisibility=hidden is supported in
 # the first place.
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 14cf7099e3..b1e58a3941 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -54,10 +54,6 @@
    don't. */
 #undef HAVE_DECL_SNPRINTF
 
-/* Define to 1 if you have the declaration of `strerror', and to 0 if you
-   don't. */
-#undef HAVE_DECL_STRERROR
-
 /* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
    */
 #undef HAVE_DECL_STRSTR
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index da17f8cb2c..ccffde80ed 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -7022,17 +7022,7 @@ fi
 done
 
 
-  ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strerror" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRERROR $ac_have_decl
-_ACEOF
-ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
+  ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strstr" = xyes; then :
   ac_have_decl=1
 else
@@ -8427,16 +8417,6 @@ _ACEOF
 
 
 
-ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strerror" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRERROR $ac_have_decl
-_ACEOF
 ac_fn_c_check_decl "$LINENO" "perror" "ac_cv_have_decl_perror" "$ac_includes_default"
 if test "x$ac_cv_have_decl_perror" = xyes; then :
   ac_have_decl=1
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 07c9bd7fa7..4a6d88ebd1 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -158,7 +158,7 @@ LIBS="$old_LIBS"
 
 libiberty_INIT
 
-AC_CHECK_DECLS([strerror, perror, vasprintf, vsnprintf])
+AC_CHECK_DECLS([perror, vasprintf, vsnprintf])
 
 AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize])
 
diff --git a/gdb/gdbserver/linux-i386-ipa.c b/gdb/gdbserver/linux-i386-ipa.c
index 2e3d1ac7fe..4bbc1b5f51 100644
--- a/gdb/gdbserver/linux-i386-ipa.c
+++ b/gdb/gdbserver/linux-i386-ipa.c
@@ -210,7 +210,7 @@ initialize_fast_tracepoint_trampoline_buffer (void)
   if (!f)
     {    
       snprintf (buf, sizeof (buf), "mmap_min_addr open failed: %s",
-		strerror (errno));
+		safe_strerror (errno));
       set_trampoline_buffer_space (0, 0, buf);
       return;
     }
@@ -233,7 +233,7 @@ initialize_fast_tracepoint_trampoline_buffer (void)
       else
 	{
 	  snprintf (buf, IPA_BUFSIZ, "low-64K-buffer mmap() failed: %s",
-		    strerror (errno));
+		    safe_strerror (errno));
 	  set_trampoline_buffer_space (0, 0, buf);
 	}
     }
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index e01c4f146e..3326159dfe 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -29,12 +29,6 @@ gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
 
 #include "gdbsupport/version.h"
 
-#if !HAVE_DECL_STRERROR
-#ifndef strerror
-extern char *strerror (int);	/* X3.159-1989  4.11.6.2 */
-#endif
-#endif
-
 #if !HAVE_DECL_PERROR
 #ifndef perror
 extern void perror (const char *);
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 2bd75dfb4a..9f8a49174c 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -6879,7 +6879,7 @@ init_named_socket (const char *name)
   result = fd = socket (PF_UNIX, SOCK_STREAM, 0);
   if (result == -1)
     {
-      warning ("socket creation failed: %s", strerror (errno));
+      warning ("socket creation failed: %s", safe_strerror (errno));
       return -1;
     }
 
@@ -6895,7 +6895,7 @@ init_named_socket (const char *name)
       result = unlink (name);
       if (result == -1)
 	{
-	  warning ("unlink failed: %s", strerror (errno));
+	  warning ("unlink failed: %s", safe_strerror (errno));
 	  close (fd);
 	  return -1;
 	}
@@ -6905,7 +6905,7 @@ init_named_socket (const char *name)
   result = bind (fd, (struct sockaddr *) &addr, sizeof (addr));
   if (result == -1)
     {
-      warning ("bind failed: %s", strerror (errno));
+      warning ("bind failed: %s", safe_strerror (errno));
       close (fd);
       return -1;
     }
@@ -6913,7 +6913,7 @@ init_named_socket (const char *name)
   result = listen (fd, 1);
   if (result == -1)
     {
-      warning ("listen: %s", strerror (errno));
+      warning ("listen: %s", safe_strerror (errno));
       close (fd);
       return -1;
     }
@@ -7219,7 +7219,7 @@ gdb_agent_helper_thread (void *arg)
 	  if (fd < 0)
 	    {
 	      warning ("Accept returned %d, error: %s",
-		       fd, strerror (errno));
+		       fd, safe_strerror (errno));
 	      break;
 	    }
 
@@ -7231,7 +7231,7 @@ gdb_agent_helper_thread (void *arg)
 	  if (ret == -1)
 	    {
 	      warning ("reading socket (fd=%d) failed with %s",
-		       fd, strerror (errno));
+		       fd, safe_strerror (errno));
 	      close (fd);
 	      break;
 	    }
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index 6a0e7a7a0f..b72dd0ec2b 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -47,7 +47,7 @@ perror_with_name (const char *string)
   const char *err;
   char *combined;
 
-  err = strerror (errno);
+  err = safe_strerror (errno);
   if (err == NULL)
     err = "unknown error";
 
diff --git a/gdb/gdbsupport/agent.c b/gdb/gdbsupport/agent.c
index 6d55f586b8..50e9500ffc 100644
--- a/gdb/gdbsupport/agent.c
+++ b/gdb/gdbsupport/agent.c
@@ -149,7 +149,7 @@ gdb_connect_sync_socket (int pid)
   res = fd = gdb_socket_cloexec (PF_UNIX, SOCK_STREAM, 0);
   if (res == -1)
     {
-      warning (_("error opening sync socket: %s"), strerror (errno));
+      warning (_("error opening sync socket: %s"), safe_strerror (errno));
       return -1;
     }
 
@@ -168,7 +168,7 @@ gdb_connect_sync_socket (int pid)
     {
       warning (_("error connecting sync socket (%s): %s. "
 		 "Make sure the directory exists and that it is writable."),
-		 path, strerror (errno));
+		 path, safe_strerror (errno));
       close (fd);
       return -1;
     }
diff --git a/gdb/gdbsupport/common.m4 b/gdb/gdbsupport/common.m4
index 4f2bb5218d..c61753fb8e 100644
--- a/gdb/gdbsupport/common.m4
+++ b/gdb/gdbsupport/common.m4
@@ -35,7 +35,7 @@ AC_DEFUN([GDB_AC_COMMON], [
   AC_CHECK_FUNCS([fdwalk getrlimit pipe pipe2 socketpair sigaction \
 		  sigprocmask])
 
-  AC_CHECK_DECLS([strerror, strstr])
+  AC_CHECK_DECLS([strstr])
 
   # Check for std::thread.  This does not work on some platforms, like
   # mingw and DJGPP.
diff --git a/gdb/gdbsupport/safe-strerror.c b/gdb/gdbsupport/safe-strerror.c
index c37db579f7..7425af590f 100644
--- a/gdb/gdbsupport/safe-strerror.c
+++ b/gdb/gdbsupport/safe-strerror.c
@@ -20,6 +20,26 @@
 #include "common-defs.h"
 #include <string.h>
 
+/* There are two different versions of strerror_r; one is GNU-specific, the
+   other XSI-compliant.  They differ in the return type.  This overload lets
+   us choose the right behavior for each return type.  We cannot rely on Gnulib
+   to solve this for us because IPA does not use Gnulib but uses this
+   function.  */
+
+/* Called if we have a XSI-compliant strerror_r.  */
+static char *
+select_strerror_r (int res, char *buf)
+{
+  return res == 0 ? buf : nullptr;
+}
+
+/* Called if we have a GNU strerror_r.  */
+static char *
+select_strerror_r (char *res, char *)
+{
+  return res;
+}
+
 /* Implementation of safe_strerror as defined in common-utils.h.  */
 
 const char *
@@ -27,11 +47,9 @@ safe_strerror (int errnum)
 {
   static thread_local char buf[1024];
 
-  /* Assign the return value to an int, so we get an error if we accidentally
-     get the wrong version of this function (glibc has two of them...).  */
-  int ret = strerror_r (errnum, buf, sizeof (buf));
-  if (ret == 0)
-    return buf;
+  char *res = select_strerror_r (strerror_r (errnum, buf, sizeof (buf)), buf);
+  if (res != nullptr)
+    return res;
 
   xsnprintf (buf, sizeof buf, "(undocumented errno %d)", errnum);
   return buf;


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] gdb/testsuite: Make use of exec_has_index_section function
@ 2019-09-13  1:14 gdb-buildbot
  2019-09-13  1:33 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-09-13  1:14 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 5fabdcd6801a4567db9c88ceb112ca222544b13f ***

commit 5fabdcd6801a4567db9c88ceb112ca222544b13f
Author:     Andrew Burgess <andrew.burgess@embecosm.com>
AuthorDate: Sun Sep 1 00:21:40 2019 +0100
Commit:     Andrew Burgess <andrew.burgess@embecosm.com>
CommitDate: Thu Sep 12 20:31:29 2019 -0400

    gdb/testsuite: Make use of exec_has_index_section function
    
    Make use of exec_has_index_section library function rather than
    manually checking in the 'maintenance info sections' output.  Should
    make no difference to the test results, just makes the code easier to
    read.
    
    gdb/testsuite/ChangeLog:
    
            * gdb.base/maint.exp: Use exec_has_index_section.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 27980548cb..395a257102 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2019-09-12  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.base/maint.exp: Use exec_has_index_section.
+
 2019-09-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* gdb.base/maint.exp: Add test for 'maint info sections'.
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index a5d5dacaba..15988c7938 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -127,18 +127,7 @@ gdb_test_multiple "maint info sections" $test {
 }
 
 # If we're using .gdb_index or .debug_names there will be no psymtabs.
-set have_gdb_index 0
-gdb_test_multiple "maint info sections .gdb_index .debug_names" "check for .gdb_index" {
-    -re ": \\.gdb_index .*\r\n$gdb_prompt $" {
-	set have_gdb_index 1
-    }
-    -re ": \\.debug_names .*\r\n$gdb_prompt $" {
-	set have_gdb_index 1
-    }
-    -re ".*$gdb_prompt $" {
-	;# Nothing to do, present to avoid a FAIL.
-    }
-}
+set have_gdb_index [ exec_has_index_section ${binfile} ]
 
 # There also won't be any psymtabs if we read the index from the index cache.
 # We can detect this by looking if the index-cache is enabled and if the number


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] gdb: Have 'maint info sections' print all sections again
@ 2019-09-13  1:12 gdb-buildbot
  2019-09-13  1:26 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-09-13  1:12 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT aa17805fb9a3a1983a510ba425b682fba03410c2 ***

commit aa17805fb9a3a1983a510ba425b682fba03410c2
Author:     Andrew Burgess <andrew.burgess@embecosm.com>
AuthorDate: Sat Aug 31 23:44:40 2019 +0100
Commit:     Andrew Burgess <andrew.burgess@embecosm.com>
CommitDate: Thu Sep 12 20:31:29 2019 -0400

    gdb: Have 'maint info sections' print all sections again
    
    In this commit:
    
      commit 6eac171f0624303d944ff1a1ae4d0e3b0a63c800
      Date:   Fri Aug 16 00:25:14 2019 +0200
    
          [gdb] Make maint info sections print relocated addresses
    
    A couple of things broke with the 'maintenance info sections' command,
    here is some before output:
    
      (gdb) maintenance info sections
      Exec file:
          `/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
              file type elf64-x86-64.
       [0]     0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
       [1]     0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
       [2]     0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
       [3]     0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
       [4]     0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
       [5]     0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
       [6]     0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
       [7]     0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
       [8]     0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
       [9]     0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
       [10]     0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
       [11]     0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
       [12]     0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
       [13]     0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
       [14]     0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
       [15]     0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
       [16]     0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
       [17]     0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
       [18]     0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
       [19]     0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
       [20]     0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
       [21]     0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
       [22]     0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
       [23]     0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
       [24]     0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS
       [25]     0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS
       [26]     0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS
       [27]     0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS
       [28]     0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS
       [29]     0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS
      (gdb)
    
    And here is the output after the above commit:
    
      (gdb) maintenance info sections
      +maintenance info sections
      Exec file:
          `/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
              file type elf64-x86-64.
          0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
          0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
          0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
          0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
          0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
          0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
          0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
          0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
          0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
          0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
          0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
          0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
          0x00000000->0x00000000 at 0x00000000: *COM* IS_COMMON
          0x00000000->0x00000000 at 0x00000000: *UND*
          0x00000000->0x00000000 at 0x00000000: *ABS*
          0x00000000->0x00000000 at 0x00000000: *IND*
      (gdb)
    
    We lost the section index numbers, but more importantly, we lost the
    information about the .debug* sections.  We also gained entries for
    the "fake" sections *COM*, *UND*, *ABS*, and *IND*.
    
    I noticed this when running:
    
      make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp"
    
    As this test relies on looking in the 'maint info sections' output to
    see if we have a .debug_names or .gdb_index section, and these are
    debug sections so they no longer show up in the 'main info sections'
    output, the gdb.base/maint.exp test fails.
    
    This commit restores the old behaviour while keeping the important
    change that the above commit introduced, the addresses printed for
    sections are the relocated addresses where appropriate.  The above
    commit mentions using this test:
    
       make check-gdb RUNTESTFLAGS="CFLAGS_FOR_TARGET='-pie' gdb.base/compare-sections.exp"
    
    And this still passes after this commit.
    
    The output for 'maint info sections' now looks like this:
    
      (gdb) maintenance info sections
      Exec file:
          `/home/andrew/projects/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
              file type elf64-x86-64.
       [0]      0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
       [1]      0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
       [2]      0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
       [3]      0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
       [4]      0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
       [5]      0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
       [6]      0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
       [7]      0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
       [8]      0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
       [9]      0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
       [10]     0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
       [11]     0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
       [12]     0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
       [13]     0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
       [14]     0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
       [15]     0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
       [16]     0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
       [17]     0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
       [18]     0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
       [19]     0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
       [20]     0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
       [21]     0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
       [22]     0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
       [23]     0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
       [24]     0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS
       [25]     0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS
       [26]     0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS
       [27]     0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS
       [28]     0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS
       [29]     0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS
      (gdb)
    
    This is basically as it was before, except that the index numbers are
    now padded so the section information all lines up.
    
    When GDB has relocated a section then the relocated addresses will be
    printed, otherwise the non-relocated addresses from the bfd will be
    printed.
    
    I've added a test to gdb.base/maint.exp to do some basic validation of
    the output format.
    
    gdb/ChangeLog:
    
            * maint.c: Add 'cmath' include.
            (struct maint_print_section_data): New structure.
            (print_section_index): New function.
            (print_bfd_section_info): Add header comment, small whitespace
            cleanup, and update to call new print_section_index function.
            (print_objfile_section_info): Likewise.
            (maint_obj_section_from_bfd_section): New function.
            (print_bfd_section_info_maybe_relocated): New function.
            (maintenance_info_sections): Add header comment, always use
            bfd_map_over_sections instead of ALL_OBJFILE_OSECTIONS.
    
    gdb/testsuite/ChangeLog:
    
            * gdb.base/maint.exp: Add test for 'maint info sections'.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9540c4f120..4158161393 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2019-09-12  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* maint.c: Add 'cmath' include.
+	(struct maint_print_section_data): New structure.
+	(print_section_index): New function.
+	(print_bfd_section_info): Add header comment, small whitespace
+	cleanup, and update to call new print_section_index function.
+	(print_objfile_section_info): Likewise.
+	(maint_obj_section_from_bfd_section): New function.
+	(print_bfd_section_info_maybe_relocated): New function.
+	(maintenance_info_sections): Add header comment, always use
+	bfd_map_over_sections instead of ALL_OBJFILE_OSECTIONS.
+
 2019-09-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* psymtab.c (find_pc_sect_psymtab): Move baseaddr local into more
diff --git a/gdb/maint.c b/gdb/maint.c
index 837ed23cfb..286ec31013 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -23,6 +23,7 @@
 #include "defs.h"
 #include "arch-utils.h"
 #include <ctype.h>
+#include <cmath>
 #include <signal.h>
 #include "command.h"
 #include "gdbcmd.h"
@@ -276,14 +277,68 @@ maint_print_section_info (const char *name, flagword flags,
   printf_filtered ("\n");
 }
 
+/* Information passed between the "maintenance info sections" command, and
+   the worker function that prints each section.  */
+struct maint_print_section_data
+{
+  /* The GDB objfile we're printing this section for.  */
+  struct objfile *objfile;
+
+  /* The argument string passed by the user to the top level maintenance
+     info sections command.  Used for filtering which sections are
+     printed.  */
+  const char *arg;
+
+  /* The number of digits in the highest section index for all sections
+     from the bfd object associated with OBJFILE.  Used when pretty
+     printing the index number to ensure all of the indexes line up.  */
+  int index_digits;
+
+  /* Constructor.  */
+  maint_print_section_data (struct objfile *objfile, const char *arg,
+			    bfd *abfd)
+    : objfile (objfile),
+      arg(arg)
+  {
+    int section_count = gdb_bfd_count_sections (abfd);
+    index_digits = ((int) log10 (section_count)) + 1;
+  }
+
+private:
+  maint_print_section_data () = delete;
+  maint_print_section_data (const maint_print_section_data &) = delete;
+};
+
+/* Helper function to pretty-print the section index of ASECT from ABFD.
+   The INDEX_DIGITS is the number of digits in the largest index that will
+   be printed, and is used to pretty-print the resulting string.  */
+
+static void
+print_section_index (bfd *abfd,
+		     asection *asect,
+		     int index_digits)
+{
+  std::string result
+    = string_printf (" [%d] ", gdb_bfd_section_index (abfd, asect));
+  /* The '+ 4' for the leading and trailing characters.  */
+  printf_filtered ("%-*s", (index_digits + 4), result.c_str ());
+}
+
+/* Print information about ASECT from ABFD.  DATUM holds a pointer to a
+   maint_print_section_data object.  The section will be printed using the
+   VMA's from the bfd, which will not be the relocated addresses for bfds
+   that should be relocated.  The information must be printed with the
+   same layout as PRINT_OBJFILE_SECTION_INFO below.  */
+
 static void
-print_bfd_section_info (bfd *abfd, 
-			asection *asect, 
+print_bfd_section_info (bfd *abfd,
+			asection *asect,
 			void *datum)
 {
   flagword flags = bfd_get_section_flags (abfd, asect);
   const char *name = bfd_section_name (abfd, asect);
-  const char *arg = (const char *) datum;
+  maint_print_section_data *print_data = (maint_print_section_data *) datum;
+  const char *arg = print_data->arg;
 
   if (arg == NULL || *arg == '\0'
       || match_substring (arg, name)
@@ -295,19 +350,25 @@ print_bfd_section_info (bfd *abfd,
 
       addr = bfd_section_vma (abfd, asect);
       endaddr = addr + bfd_section_size (abfd, asect);
-      printf_filtered (" [%d] ", gdb_bfd_section_index (abfd, asect));
+      print_section_index (abfd, asect, print_data->index_digits);
       maint_print_section_info (name, flags, addr, endaddr,
 				asect->filepos, addr_size);
     }
 }
 
+/* Print information about ASECT which is GDB's wrapper around a section
+   from ABFD.  The information must be printed with the same layout as
+   PRINT_BFD_SECTION_INFO above.  PRINT_DATA holds information used to
+   filter which sections are printed, and for formatting the output.  */
+
 static void
-print_objfile_section_info (bfd *abfd, 
-			    struct obj_section *asect, 
-			    const char *string)
+print_objfile_section_info (bfd *abfd,
+			    struct obj_section *asect,
+			    maint_print_section_data *print_data)
 {
   flagword flags = bfd_get_section_flags (abfd, asect->the_bfd_section);
   const char *name = bfd_section_name (abfd, asect->the_bfd_section);
+  const char *string = print_data->arg;
 
   if (string == NULL || *string == '\0'
       || match_substring (string, name)
@@ -316,6 +377,8 @@ print_objfile_section_info (bfd *abfd,
       struct gdbarch *gdbarch = gdbarch_from_bfd (abfd);
       int addr_size = gdbarch_addr_bit (gdbarch) / 8;
 
+      print_section_index (abfd, asect->the_bfd_section,
+			   print_data->index_digits);
       maint_print_section_info (name, flags,
 				obj_section_addr (asect),
 				obj_section_endaddr (asect),
@@ -324,12 +387,56 @@ print_objfile_section_info (bfd *abfd,
     }
 }
 
+/* Find an obj_section, GDB's wrapper around a bfd section for ASECTION
+   from ABFD.  It might be that no such wrapper exists (for example debug
+   sections don't have such wrappers) in which case nullptr is returned.  */
+
+static obj_section *
+maint_obj_section_from_bfd_section (bfd *abfd,
+				    asection *asection,
+				    objfile *ofile)
+{
+  if (ofile->sections == nullptr)
+    return nullptr;
+
+  obj_section *osect
+    = &ofile->sections[gdb_bfd_section_index (abfd, asection)];
+
+  if (osect >= ofile->sections_end)
+    return nullptr;
+
+  return osect;
+}
+
+/* Print information about ASECT from ABFD.  DATUM holds a pointer to a
+   maint_print_section_data object.  Where possible the information for
+   ASECT will print the relocated addresses of the section.  */
+
+static void
+print_bfd_section_info_maybe_relocated (bfd *abfd,
+					asection *asect,
+					void *datum)
+{
+  maint_print_section_data *print_data = (maint_print_section_data *) datum;
+  objfile *objfile = print_data->objfile;
+
+  gdb_assert (objfile->sections != NULL);
+  obj_section *osect
+    = maint_obj_section_from_bfd_section (abfd, asect, objfile);
+
+  if (osect->the_bfd_section == NULL)
+    print_bfd_section_info (abfd, asect, datum);
+  else
+    print_objfile_section_info (abfd, osect, print_data);
+}
+
+/* Implement the "maintenance info sections" command.  */
+
 static void
 maintenance_info_sections (const char *arg, int from_tty)
 {
   if (exec_bfd)
     {
-      struct obj_section *osect;
       bool allobj = false;
 
       printf_filtered (_("Exec file:\n"));
@@ -352,22 +459,27 @@ maintenance_info_sections (const char *arg, int from_tty)
 	  if (allobj)
 	    printf_filtered (_("  Object file: %s\n"),
 			     bfd_get_filename (ofile->obfd));
-	  ALL_OBJFILE_OSECTIONS (ofile, osect)
-	    {
-	      if (!allobj && ofile->obfd != exec_bfd)
-		continue;
-	      print_objfile_section_info (ofile->obfd, osect, arg);
-	    }
+	  else if (ofile->obfd != exec_bfd)
+	    continue;
+
+	  maint_print_section_data print_data (ofile, arg, ofile->obfd);
+
+	  bfd_map_over_sections (ofile->obfd,
+				 print_bfd_section_info_maybe_relocated,
+				 (void *) &print_data);
 	}
     }
 
   if (core_bfd)
     {
+      maint_print_section_data print_data (nullptr, arg, core_bfd);
+
       printf_filtered (_("Core file:\n"));
       printf_filtered ("    `%s', ", bfd_get_filename (core_bfd));
       wrap_here ("        ");
       printf_filtered (_("file type %s.\n"), bfd_get_target (core_bfd));
-      bfd_map_over_sections (core_bfd, print_bfd_section_info, (void *) arg);
+      bfd_map_over_sections (core_bfd, print_bfd_section_info,
+			     (void *) &print_data);
     }
 }
 
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7352e9f034..27980548cb 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2019-09-12  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.base/maint.exp: Add test for 'maint info sections'.
+
 2019-09-12  Tom de Vries  <tdevries@suse.de>
 
 	* gdb.base/store.exp: Allow register variables to be optimized out at
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 36738f6eaa..a5d5dacaba 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -109,6 +109,23 @@ if ![runto_main] then {
         perror "tests suppressed"
 }
 
+# Check that 'maint info sections' output looks correct.  When
+# checking the lines for each section we reject section names starting
+# with a '*' character, the internal *COM*, *UND*, *ABS*, and *IND*
+# sections should not be displayed in this output.
+set test "check maint info sections output"
+gdb_test_multiple "maint info sections" $test {
+    -re "Exec file:\r\n\[\t ]+`\[^'\]+', file type \[^.\]+\.\r\n" {
+	exp_continue
+    }
+    -re "^ \\\[\[0-9\]+\\\]\[\t \]+$hex->$hex at $hex: \[^*\r\]+\r\n" {
+	exp_continue
+    }
+    -re "^$gdb_prompt $" {
+	pass $test
+    }
+}
+
 # If we're using .gdb_index or .debug_names there will be no psymtabs.
 set have_gdb_index 0
 gdb_test_multiple "maint info sections .gdb_index .debug_names" "check for .gdb_index" {


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Introduce reset_locator function in tui-layout.c
@ 2019-07-18  1:24 gdb-buildbot
  2019-07-18  2:07 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-07-18  1:24 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 1bf605de8e9ae4fcf77c21067ddaf4a242a873f7 ***

commit 1bf605de8e9ae4fcf77c21067ddaf4a242a873f7
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Fri Jun 28 23:56:25 2019 -0600
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Wed Jul 17 12:19:13 2019 -0600

    Introduce reset_locator function in tui-layout.c
    
    init_and_make_win in tui-layout.c is now only called for the locator
    -- earlier changes have made most of the cases here obsolete.  This
    patch removes init_and_make_win and introduces a reset_locator
    function.  Window creation is now much simpler to follow, because it
    is no longer quite so dynamic.  (Though it will become even simpler in
    coming patches.)
    
    gdb/ChangeLog
    2019-07-17  Tom Tromey  <tom@tromey.com>
    
            * tui/tui-layout.c (show_source_disasm_command): Use
            reset_locator.
            (reset_locator): New function.
            (init_and_make_win): Remove.
            (show_source_or_disasm_and_command): Use reset_locator.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1c56652d8a..76549e029a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-layout.c (show_source_disasm_command): Use
+	reset_locator.
+	(reset_locator): New function.
+	(init_and_make_win): Remove.
+	(show_source_or_disasm_and_command): Use reset_locator.
+
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui-winsource.c (tui_set_exec_info_content): Remove
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 23537b7f49..ab849a9813 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -43,10 +43,8 @@
 ** Static Local Decls
 ********************************/
 static void show_layout (enum tui_layout_type);
-static tui_gen_win_info *init_and_make_win (tui_gen_win_info *,
-					    enum tui_win_type,
-					    int, int, int, int,
-					    enum tui_box);
+static void reset_locator (tui_gen_win_info *,
+			   int, int, int, int);
 static void show_source_or_disasm_and_command (enum tui_layout_type);
 static struct tui_win_info *make_command_window (int, int);
 static struct tui_win_info *make_source_window (int, int);
@@ -614,13 +612,11 @@ show_source_disasm_command (void)
 	{
 	  tui_win_list[DISASSEM_WIN]
 	    = make_disasm_window (asm_height, src_height - 1);
-	  init_and_make_win (locator,
-			     LOCATOR_WIN,
-			     2 /* 1 */ ,
-			     tui_term_width (),
-			     0,
-			     (src_height + asm_height) - 1,
-			     DONT_BOX_WINDOW);
+	  reset_locator (locator,
+			 2 /* 1 */ ,
+			 tui_term_width (),
+			 0,
+			 (src_height + asm_height) - 1);
 	}
       else
 	{
@@ -696,13 +692,11 @@ show_data (enum tui_layout_type new_layout)
       else
 	tui_win_list[win_type]
 	  = make_disasm_window (src_height, data_height - 1);
-      init_and_make_win (locator,
-			     LOCATOR_WIN,
-			     2 /* 1 */ ,
-			     tui_term_width (),
-			     0,
-			     total_height - 1,
-			     DONT_BOX_WINDOW);
+      reset_locator (locator,
+		     2 /* 1 */ ,
+		     tui_term_width (),
+		     0,
+		     total_height - 1);
       base = (tui_source_window_base *) tui_win_list[win_type];
     }
   else
@@ -751,48 +745,13 @@ tui_gen_win_info::reset (enum tui_win_type win_type,
   origin.y = origin_y_;
 }
 
-/* init_and_make_win().
- */
-static tui_gen_win_info *
-init_and_make_win (tui_gen_win_info *win_info, 
-		   enum tui_win_type win_type,
-		   int height, int width, 
-		   int origin_x, int origin_y,
-		   enum tui_box box_it)
+static void
+reset_locator (tui_gen_win_info *win_info, 
+	       int height, int width, 
+	       int origin_x, int origin_y)
 {
-  if (win_info == NULL)
-    {
-      switch (win_type)
-	{
-	case SRC_WIN:
-	  win_info = new tui_source_window ();
-	  break;
-
-	case DISASSEM_WIN:
-	  win_info = new tui_disasm_window ();
-	  break;
-
-	case DATA_WIN:
-	  win_info = new tui_data_window ();
-	  break;
-
-	case CMD_WIN:
-	  win_info = new tui_cmd_window ();
-	  break;
-
-	case EXEC_INFO_WIN:
-	  win_info = new tui_exec_info_window ();
-	  break;
-
-	default:
-	  gdb_assert_not_reached (_("unhandled window type"));
-	}
-    }
-
-  win_info->reset (win_type, height, width, origin_x, origin_y);
-  tui_make_window (win_info, box_it);
-
-  return win_info;
+  win_info->reset (LOCATOR_WIN, height, width, origin_x, origin_y);
+  tui_make_window (win_info, DONT_BOX_WINDOW);
 }
 
 
@@ -825,13 +784,11 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
 	    *win_info_ptr = make_source_window (src_height - 1, 0);
 	  else
 	    *win_info_ptr = make_disasm_window (src_height - 1, 0);
-	  init_and_make_win (locator,
-			     LOCATOR_WIN,
-			     2 /* 1 */ ,
-			     tui_term_width (),
-			     0,
-			     src_height - 1,
-			     DONT_BOX_WINDOW);
+	  reset_locator (locator,
+			 2 /* 1 */ ,
+			 tui_term_width (),
+			 0,
+			 src_height - 1);
 	  base = (tui_source_window_base *) *win_info_ptr;
 	}
       else


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Always create an execution info window for a source window
@ 2019-07-18  1:11 gdb-buildbot
  2019-07-18  1:46 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-07-18  1:11 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 098f9ed48e1c94a2624c825ba93d72b163d41196 ***

commit 098f9ed48e1c94a2624c825ba93d72b163d41196
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Fri Jun 28 23:54:25 2019 -0600
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Wed Jul 17 12:19:12 2019 -0600

    Always create an execution info window for a source window
    
    A source or disassembly window will always have an "execution info"
    window (the window along the side that displays breakpoint info), but
    this isn't immediately clear from the source.  As a result, some code
    has checks to see whether the execution_info is NULL.
    
    This changes the source window base class to always instantiate an
    execution_info window, then updates the rest of the code.  It also
    simplifies window creation in tui-layout.c.
    
    gdb/ChangeLog
    2019-07-17  Tom Tromey  <tom@tromey.com>
    
            * tui/tui-winsource.c (tui_set_exec_info_content): Remove
            condition.
            * tui/tui-wingeneral.c (tui_source_window_base::make_visible):
            Remove condition.
            * tui/tui-source.c (tui_source_window_base::reset): New method.
            * tui/tui-layout.c (make_command_window): Don't call
            init_and_make_win.
            (make_source_window, make_disasm_window): Don't call
            make_source_or_disasm_window.
            (make_data_window): Don't call init_and_make_win.  Change calling
            convention.
            (show_source_disasm_command, show_data): Simplify.
            (make_source_or_disasm_window): Remove.
            (show_source_or_disasm_and_command): Simplify.
            * tui/tui-data.h (struct tui_gen_win_info) <reset>: Now virtual.
            (struct tui_source_window_base) <reset>: Likewise.
            <execution_info>: Remove initializer.
            * tui/tui-data.c (tui_source_window_base): Initialize
            execution_info.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 338c39a043..1c56652d8a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,25 @@
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-winsource.c (tui_set_exec_info_content): Remove
+	condition.
+	* tui/tui-wingeneral.c (tui_source_window_base::make_visible):
+	Remove condition.
+	* tui/tui-source.c (tui_source_window_base::reset): New method.
+	* tui/tui-layout.c (make_command_window): Don't call
+	init_and_make_win.
+	(make_source_window, make_disasm_window): Don't call
+	make_source_or_disasm_window.
+	(make_data_window): Don't call init_and_make_win.  Change calling
+	convention.
+	(show_source_disasm_command, show_data): Simplify.
+	(make_source_or_disasm_window): Remove.
+	(show_source_or_disasm_and_command): Simplify.
+	* tui/tui-data.h (struct tui_gen_win_info) <reset>: Now virtual.
+	(struct tui_source_window_base) <reset>: Likewise.
+	<execution_info>: Remove initializer.
+	* tui/tui-data.c (tui_source_window_base): Initialize
+	execution_info.
+
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui-layout.c (tui_set_layout): Remove regs_populate
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 396635b779..ee5b3aa3a7 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -332,7 +332,8 @@ tui_win_info::tui_win_info (enum tui_win_type type)
 }
 
 tui_source_window_base::tui_source_window_base (enum tui_win_type type)
-  : tui_win_info (type)
+  : tui_win_info (type),
+    execution_info (new tui_exec_info_window ())
 {
   gdb_assert (type == SRC_WIN || type == DISASSEM_WIN);
   start_line_or_addr.loa = LOA_ADDRESS;
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index fcbb940728..9bcfe4cfaf 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -61,9 +61,9 @@ public:
   /* Reset this window.  WIN_TYPE must match the existing type of this
      window (it is only passed for self-test purposes).  The other
      parameters are used to set the window's size and position.  */
-  void reset (enum tui_win_type win_type,
-	      int height, int width,
-	      int origin_x, int origin_y);
+  virtual void reset (enum tui_win_type win_type,
+		      int height, int width,
+		      int origin_x, int origin_y);
 
   /* Window handle.  */
   WINDOW *handle = nullptr;
@@ -395,10 +395,14 @@ public:
      LINE_NO in this source window; false otherwise.  */
   virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0;
 
+  void reset (enum tui_win_type win_type,
+	      int height, int width,
+	      int origin_x, int origin_y) override;
+
   /* Does the locator belong to this window?  */
   bool m_has_locator = false;
   /* Execution information window.  */
-  struct tui_exec_info_window *execution_info = nullptr;
+  struct tui_exec_info_window *execution_info;
   /* Used for horizontal scroll.  */
   int horizontal_offset = 0;
   struct tui_line_or_address start_line_or_addr;
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index ac0d01c990..23537b7f49 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -48,12 +48,9 @@ static tui_gen_win_info *init_and_make_win (tui_gen_win_info *,
 					    int, int, int, int,
 					    enum tui_box);
 static void show_source_or_disasm_and_command (enum tui_layout_type);
-static struct tui_win_info *make_source_or_disasm_window (enum tui_win_type, 
-							  int, int);
 static struct tui_win_info *make_command_window (int, int);
 static struct tui_win_info *make_source_window (int, int);
 static struct tui_win_info *make_disasm_window (int, int);
-static void make_data_window (struct tui_win_info **, int, int);
 static void show_source_command (void);
 static void show_disasm_command (void);
 static void show_source_disasm_command (void);
@@ -522,14 +519,9 @@ prev_layout (void)
 static struct tui_win_info *
 make_command_window (int height, int origin_y)
 {
-  struct tui_win_info *result
-    = (struct tui_win_info *) init_and_make_win (NULL,
-						 CMD_WIN,
-						 height,
-						 tui_term_width (),
-						 0,
-						 origin_y,
-						 DONT_BOX_WINDOW);
+  struct tui_win_info *result = new tui_cmd_window ();
+  result->reset (CMD_WIN, height, tui_term_width (), 0, origin_y);
+  tui_make_window (result, DONT_BOX_WINDOW);
   return result;
 }
 
@@ -539,8 +531,11 @@ make_command_window (int height, int origin_y)
 static struct tui_win_info *
 make_source_window (int height, int origin_y)
 {
-  return make_source_or_disasm_window (SRC_WIN, height, origin_y);
-}				/* make_source_window */
+  tui_win_info *result = new tui_source_window ();
+  result->reset (SRC_WIN, height, tui_term_width (), 0, origin_y);
+  result->make_visible (true);
+  return result;
+}
 
 
 /* make_disasm_window().
@@ -548,22 +543,20 @@ make_source_window (int height, int origin_y)
 static struct tui_win_info *
 make_disasm_window (int height, int origin_y)
 {
-  return make_source_or_disasm_window (DISASSEM_WIN, height, origin_y);
-}				/* make_disasm_window */
+  tui_win_info *result = new tui_disasm_window ();
+  result->reset (SRC_WIN, height, tui_term_width (), 0, origin_y);
+  result->make_visible (true);
+  return result;
+}
 
 
-static void
-make_data_window (struct tui_win_info **win_info_ptr, 
-		  int height, int origin_y)
+static tui_win_info *
+make_data_window (int height, int origin_y)
 {
-  *win_info_ptr
-    = (struct tui_win_info *) init_and_make_win (*win_info_ptr,
-						 DATA_WIN,
-						 height,
-						 tui_term_width (),
-						 0,
-						 origin_y,
-						 BOX_WINDOW);
+  tui_win_info *result = new tui_data_window ();
+  result->reset (DATA_WIN, height, tui_term_width (), 0, origin_y);
+  result->make_visible (true);
+  return result;
 }
 
 
@@ -606,16 +599,10 @@ show_source_disasm_command (void)
 	{
 	  TUI_SRC_WIN->reset (TUI_SRC_WIN->type,
 			      src_height,
-			      TUI_SRC_WIN->width,
-			      TUI_SRC_WIN->execution_info->width,
+			      tui_term_width (),
+			      0,
 			      0);
-	  TUI_SRC_WIN->execution_info->reset (EXEC_INFO_WIN,
-					      src_height,
-					      3,
-					      0,
-					      0);
 	  tui_make_visible (TUI_SRC_WIN);
-	  tui_make_visible (TUI_SRC_WIN->execution_info);
 	  TUI_SRC_WIN->m_has_locator = false;
 	}
 
@@ -645,16 +632,10 @@ show_source_disasm_command (void)
 	  TUI_DISASM_WIN->m_has_locator = true;
 	  TUI_DISASM_WIN->reset (TUI_DISASM_WIN->type,
 				 asm_height,
-				 TUI_DISASM_WIN->width,
-				 TUI_DISASM_WIN->execution_info->width,
+				 tui_term_width (),
+				 0,
 				 src_height - 1);
-	  TUI_DISASM_WIN->execution_info->reset (EXEC_INFO_WIN,
-						 asm_height,
-						 3,
-						 0,
-						 src_height - 1);
 	  tui_make_visible (TUI_DISASM_WIN);
-	  tui_make_visible (TUI_DISASM_WIN->execution_info);
 	}
       TUI_SRC_WIN->m_has_locator = false;
       TUI_DISASM_WIN->m_has_locator = true;
@@ -695,7 +676,12 @@ show_data (enum tui_layout_type new_layout)
   src_height = total_height - data_height;
   tui_make_all_invisible ();
   tui_make_invisible (locator);
-  make_data_window (&tui_win_list[DATA_WIN], data_height, 0);
+  if (tui_win_list[DATA_WIN] == nullptr)
+    tui_win_list[DATA_WIN] = make_data_window (data_height, 0);
+  else
+    tui_win_list[DATA_WIN]->reset (data_height, tui_term_width (), 0, 0);
+  tui_win_list[DATA_WIN]->make_visible (true);
+
   if (new_layout == SRC_DATA_COMMAND)
     win_type = SRC_WIN;
   else
@@ -724,16 +710,10 @@ show_data (enum tui_layout_type new_layout)
       base = (tui_source_window_base *) tui_win_list[win_type];
       tui_win_list[win_type]->reset (tui_win_list[win_type]->type,
 				     src_height,
-				     tui_win_list[win_type]->width,
-				     base->execution_info->width,
+				     tui_term_width (),
+				     0,
 				     data_height - 1);
-      base->execution_info->reset (EXEC_INFO_WIN,
-				   src_height,
-				   3,
-				   0,
-				   data_height - 1);
       tui_make_visible (tui_win_list[win_type]);
-      tui_make_visible (base->execution_info);
       locator->reset (LOCATOR_WIN,
 		      2 /* 1 */ ,
 		      tui_term_width (),
@@ -816,34 +796,6 @@ init_and_make_win (tui_gen_win_info *win_info,
 }
 
 
-static struct tui_win_info *
-make_source_or_disasm_window (enum tui_win_type type,
-			      int height, int origin_y)
-{
-  struct tui_exec_info_window *execution_info
-    = (tui_exec_info_window *) init_and_make_win (nullptr,
-						  EXEC_INFO_WIN,
-						  height,
-						  3,
-						  0,
-						  origin_y,
-						  DONT_BOX_WINDOW);
-
-  /* Now create the source window.  */
-  struct tui_source_window_base *result
-    = ((struct tui_source_window_base *)
-       init_and_make_win (NULL,
-			  type,
-			  height,
-			  tui_term_width () - execution_info->width,
-			  execution_info->width,
-			  origin_y,
-			  BOX_WINDOW));
-  result->execution_info = execution_info;
-  return result;
-}
-
-
 /* Show the Source/Command or the Disassem layout.  */
 static void
 show_source_or_disasm_and_command (enum tui_layout_type layout_type)
@@ -893,16 +845,10 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
 	  base->m_has_locator = true;
 	  (*win_info_ptr)->reset ((*win_info_ptr)->type,
 				  src_height - 1,
-				  (*win_info_ptr)->width,
-				  base->execution_info->width,
+				  tui_term_width (),
+				  0,
 				  0);
-	  base->execution_info->reset (EXEC_INFO_WIN,
-				       src_height - 1,
-				       3,
-				       0,
-				       0);
 	  tui_make_visible (*win_info_ptr);
-	  tui_make_visible (base->execution_info);
 	}
 
       base->m_has_locator = true;
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index f0bac24bfe..873612fecc 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -291,3 +291,13 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no)
 	  && filename_cmp (fullname,
 			   symtab_to_fullname (loc->symtab)) == 0);
 }
+
+void
+tui_source_window_base::reset (enum tui_win_type win_type,
+			       int height, int width,
+			       int origin_x, int origin_y)
+{
+  tui_gen_win_info::reset (win_type, height, width - 3,
+			   origin_x + 3, origin_y);
+  execution_info->reset (EXEC_INFO_WIN, height, 3, origin_x, origin_y);
+}
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index dc008cd719..3dca621b88 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -201,8 +201,7 @@ tui_make_invisible (struct tui_gen_win_info *win_info)
 void
 tui_source_window_base::make_visible (bool visible)
 {
-  if (execution_info != nullptr)
-    execution_info->make_visible (visible);
+  execution_info->make_visible (visible);
   tui_win_info::make_visible (visible);
 }
 
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 38d5532912..d9f6425109 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -469,39 +469,36 @@ tui_exec_info_window::maybe_allocate_content (int n_elements)
 void
 tui_set_exec_info_content (struct tui_source_window_base *win_info)
 {
-  if (win_info->execution_info != NULL)
-    {
-      tui_exec_info_content *content
-	= win_info->execution_info->maybe_allocate_content (win_info->height);
+  tui_exec_info_content *content
+    = win_info->execution_info->maybe_allocate_content (win_info->height);
 
-      tui_update_breakpoint_info (win_info, nullptr, true);
-      for (int i = 0; i < win_info->content.size (); i++)
-	{
-	  tui_exec_info_content &element = content[i];
-	  struct tui_source_element *src_element;
-	  tui_bp_flags mode;
-
-	  src_element = &win_info->content[i];
-
-	  memset (element, ' ', sizeof (tui_exec_info_content));
-	  element[TUI_EXECINFO_SIZE - 1] = 0;
-
-	  /* Now update the exec info content based upon the state
-	     of each line as indicated by the source content.  */
-	  mode = src_element->break_mode;
-	  if (mode & TUI_BP_HIT)
-	    element[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
-	  else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
-	    element[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'h' : 'b';
-
-	  if (mode & TUI_BP_ENABLED)
-	    element[TUI_BP_BREAK_POS] = '+';
-	  else if (mode & TUI_BP_DISABLED)
-	    element[TUI_BP_BREAK_POS] = '-';
-
-	  if (src_element->is_exec_point)
-	    element[TUI_EXEC_POS] = '>';
-	}
+  tui_update_breakpoint_info (win_info, nullptr, true);
+  for (int i = 0; i < win_info->content.size (); i++)
+    {
+      tui_exec_info_content &element = content[i];
+      struct tui_source_element *src_element;
+      tui_bp_flags mode;
+
+      src_element = &win_info->content[i];
+
+      memset (element, ' ', sizeof (tui_exec_info_content));
+      element[TUI_EXECINFO_SIZE - 1] = 0;
+
+      /* Now update the exec info content based upon the state
+	 of each line as indicated by the source content.  */
+      mode = src_element->break_mode;
+      if (mode & TUI_BP_HIT)
+	element[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
+      else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
+	element[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'h' : 'b';
+
+      if (mode & TUI_BP_ENABLED)
+	element[TUI_BP_BREAK_POS] = '+';
+      else if (mode & TUI_BP_DISABLED)
+	element[TUI_BP_BREAK_POS] = '-';
+
+      if (src_element->is_exec_point)
+	element[TUI_EXEC_POS] = '>';
     }
 }
 


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] elf: Remove the property after reporting its removal
@ 2019-06-25  8:03 gdb-buildbot
  2019-06-25  8:19 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: gdb-buildbot @ 2019-06-25  8:03 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT f93ab3a0b8039a1667a666f013cca50b03d67f9b ***

commit f93ab3a0b8039a1667a666f013cca50b03d67f9b
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Mon Jun 24 11:08:40 2019 -0700
Commit:     H.J. Lu <hjl.tools@gmail.com>
CommitDate: Mon Jun 24 11:08:57 2019 -0700

    elf: Remove the property after reporting its removal
    
    commit d2ef37ebd9f771d06edf1fdea37970f60b242b2d
    Author: H.J. Lu <hjl.tools@gmail.com>
    Date:   Fri Dec 7 08:30:30 2018 -0800
    
        elf: Report property change when merging properties
    
    failed to remove the property after reporting it has been removed.  This
    patch corrects it.
    
    bfd/
    
            PR ld/24721
            * elf-properties.c (elf_merge_gnu_property_list): Remove the
            property after reporting property removal.
    
    ld/
    
            PR ld/24721
            * testsuite/ld-x86-64/x86-64.exp: Run PR ld/24721 tests.
            * testsuite/ld-x86-64/pr24721-x32.d: New file.
            * testsuite/ld-x86-64/pr24721.d: Likewise.
            * testsuite/ld-x86-64/pr24721.map: Likewise.
            * testsuite/ld-x86-64/pr24721a.s: Likewise.
            * testsuite/ld-x86-64/pr24721b.s: Likewise.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0914e7d633..ec272a8731 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2019-06-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/24721
+	* elf-properties.c (elf_merge_gnu_property_list): Remove the
+	property after reporting property removal.
+
 2019-06-23  Alan Modra  <amodra@gmail.com>
 
 	PR 24704
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index 94ef2351cb..a297c9c5c2 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -322,12 +322,10 @@ elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *first_pbfd,
 			 (bfd_vma) p->property.pr_type, first_pbfd, abfd);
 		  }
 	      }
-	    else
-	      {
-		/* Remove this property.  */
-		*lastp = p->next;
-		continue;
-	      }
+
+	    /* Remove this property.  */
+	    *lastp = p->next;
+	    continue;
 	  }
 	else if (number_p)
 	  {
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 6dcfe30696..2c11a66c5c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,13 @@
+2019-06-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/24721
+	* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24721 tests.
+	* testsuite/ld-x86-64/pr24721-x32.d: New file.
+	* testsuite/ld-x86-64/pr24721.d: Likewise.
+	* testsuite/ld-x86-64/pr24721.map: Likewise.
+	* testsuite/ld-x86-64/pr24721a.s: Likewise.
+	* testsuite/ld-x86-64/pr24721b.s: Likewise.
+
 2019-06-23  Alan Modra  <amodra@gmail.com>
 
 	PR 24704
diff --git a/ld/testsuite/ld-x86-64/pr24721-x32.d b/ld/testsuite/ld-x86-64/pr24721-x32.d
new file mode 100644
index 0000000000..9b067efdc1
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721-x32.d
@@ -0,0 +1,6 @@
+#source: pr24721a.s
+#source: pr24721b.s
+#as: --x32 -mx86-used-note=no
+#ld: -r -m elf32_x86_64 -Map tmpdir/pr24721.map
+#readelf: -n
+#map: pr24721.map
diff --git a/ld/testsuite/ld-x86-64/pr24721.d b/ld/testsuite/ld-x86-64/pr24721.d
new file mode 100644
index 0000000000..efa88db2b3
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721.d
@@ -0,0 +1,6 @@
+#source: pr24721a.s
+#source: pr24721b.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=no
+#ld: -r -melf_x86_64 -Map tmpdir/pr24721.map
+#readelf: -n
+#map: pr24721.map
diff --git a/ld/testsuite/ld-x86-64/pr24721.map b/ld/testsuite/ld-x86-64/pr24721.map
new file mode 100644
index 0000000000..9e63fff275
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721.map
@@ -0,0 +1,3 @@
+#...
+Removed property 0xc0000002 to merge tmpdir/pr24721a.o \(0x1\) and tmpdir/pr24721b.o \(not found\)
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr24721a.s b/ld/testsuite/ld-x86-64/pr24721a.s
new file mode 100644
index 0000000000..b229d19b02
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721a.s
@@ -0,0 +1,34 @@
+	.text
+	.globl foo
+	.type foo,@function
+	.p2align 4
+foo:
+	ret
+
+	.section ".note.gnu.property", "a"
+.ifdef __64_bit__
+	.p2align 3
+.else
+	.p2align 2
+.endif
+	.long 1f - 0f		/* name length */
+	.long 5f - 2f		/* data length */
+	.long 5			/* note type */
+0:	.asciz "GNU"		/* vendor name */
+1:
+.ifdef __64_bit__
+	.p2align 3
+.else
+	.p2align 2
+.endif
+2:	.long 0xc0000002	/* pr_type.  */
+	.long 4f - 3f		/* pr_datasz.  */
+3:
+	.long 0x1
+4:
+.ifdef __64_bit__
+	.p2align 3
+.else
+	.p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/pr24721b.s b/ld/testsuite/ld-x86-64/pr24721b.s
new file mode 100644
index 0000000000..3d11691166
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721b.s
@@ -0,0 +1,6 @@
+	.text
+	.globl bar
+	.type bar,@function
+	.p2align 4
+bar:
+	ret
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 23f202017c..d815e5d633 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -456,6 +456,8 @@ run_dump_test "pr24458b"
 run_dump_test "pr24458b-x32"
 run_dump_test "pr24458c"
 run_dump_test "pr24458c-x32"
+run_dump_test "pr24721"
+run_dump_test "pr24721-x32"
 
 if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
     return


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Two comment fixes in gdbtypes.h
@ 2019-05-30 16:46 sergiodj+buildbot
  2019-05-30 20:26 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-30 16:46 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT bfcdb85206cd3c3b8ad73b13db6bfb2ec608239b ***

Author: Tom Tromey <tromey@adacore.com>
Branch: master
Commit: bfcdb85206cd3c3b8ad73b13db6bfb2ec608239b

Two comment fixes in gdbtypes.h

This fixes a couple of comments in gdbtypes.h.  One comment had a
typo; and another comment referred to "Moto", which is presumably some
long-gone Motorola-related project.

Tested by rebuilding.

gdb/ChangeLog
2019-05-30  Tom Tromey  <tromey@adacore.com>

	* gdbtypes.h (struct range_bounds) <flag_upper_bound_is_count>:
	Fix comment.
	(TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED): Rewrite comment.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Initialize variable word in complete
@ 2019-05-30 14:19 sergiodj+buildbot
  2019-05-30 14:32 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-30 14:19 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 0ef209f22c24b9243de68c35c576f7111198f915 ***

Author: Jan Vrany <jan.vrany@fit.cvut.cz>
Branch: master
Commit: 0ef209f22c24b9243de68c35c576f7111198f915

Initialize variable word in complete

The complete function should set parameter word to the end of the
word to complete. However, completion_find_completion_word may fail,
leaving word uninitialized.

To make sure word is always set, initialize it to the completion point
which is the end of the line parameter.

gdb/Changelog

	PR cli/24587
	* completer.c (complete): Initialize variable word.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Revert "Sync top level files with versions from gcc."
@ 2019-05-30 11:54 sergiodj+buildbot
  2019-05-30 12:05 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-30 11:54 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT e3f56a99f66298bb505d0426950b9716a853a5df ***

Author: Nick Clifton <nickc@redhat.com>
Branch: master
Commit: e3f56a99f66298bb505d0426950b9716a853a5df

Revert "Sync top level files with versions from gcc."

This reverts commit f948b2de97884bfb4e5fc11d40a6bea9e0b096ae.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Don't crash is dwarf_decode_macro_bytes's 'body' is NULL, even when '!is_define'
@ 2019-05-29 21:49 sergiodj+buildbot
  2019-05-29 22:15 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 21:49 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 955b06fa576df1a6954263043ea3f3a5b9ad5940 ***

Author: Sergio Durigan Junior <sergiodj@redhat.com>
Branch: master
Commit: 955b06fa576df1a6954263043ea3f3a5b9ad5940

Don't crash is dwarf_decode_macro_bytes's 'body' is NULL, even when '!is_define'

Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1715008

On commit 7bede82892a06e6c26989803e70f53697392dcf9 ("Don't crash if
dwarf_decode_macro_bytes's 'body' is NULL"), I was too strict when
checking if 'body' is NULL: the check only comprised the case when
'is_define' is true.  However, the corruption of .debug_macro by
rpmbuild's "debugedit" also affects the case when 'is_define' is
false, i.e., when the macro is being undefined.

This commit improves the check and covers both cases now.  This has
been tested on Fedora 30 with a problematic debuginfo, and I don't see
a segfault anymore.

OK to push?

gdb/ChangeLog:
2019-05-29  Sergio Durigan Junior  <sergiodj@redhat.com>

	Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192
	Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1715008
	* dwarf2read.c (dwarf_decode_macro_bytes): Move check to see if
	'body' is NULL to the outter 'if', protecting the '!is_define'
	situation as well.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Make some DWARF complaints clearer
@ 2019-05-29 16:38 sergiodj+buildbot
  2019-05-29 17:00 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 16:38 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT fa9c3fa035433debc24503e32c59688650ffcdbb ***

Author: Tom Tromey <tromey@adacore.com>
Branch: master
Commit: fa9c3fa035433debc24503e32c59688650ffcdbb

Make some DWARF complaints clearer

I noticed that the complaint in partial_die_parent_scope was not using
dwarf_tag_name, so I changed that.  Then I noticed that dwarf_tag_name
does not show the numeric value for an unrecognized tag, so I changed
that function and all the related functions to do so.

gdb/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	* dwarf2read.c (partial_die_parent_scope): Call dwarf_tag_name.
	(dwarf_unknown): New function.
	(dwarf_tag_name, dwarf_attr_name, dwarf_form_name)
	(dwarf_type_encoding_name): Use dwarf_unknown.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Fix crash in cp_print_value_fields
@ 2019-05-29 16:22 sergiodj+buildbot
  2019-05-29 16:31 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 16:22 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 4330d61dfb05d77fd925efdca45091f12e3a6266 ***

Author: Tom Tromey <tromey@adacore.com>
Branch: master
Commit: 4330d61dfb05d77fd925efdca45091f12e3a6266

Fix crash in cp_print_value_fields

PR c++/20020 concerns a crash in cp_print_value_fields.  The immediate
cause is that cp_print_value_fields does not handle the case where
value_static_field fails.  This is fixed in this patch by calling
cp_print_static_field from the "try" block.

Digging a bit deeper, the error occurs because GCC does not emit a
DW_AT_const_value for a static constexpr member appearing in a
template class.  I've filed a GCC bug for this.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	PR c++/20020:
	* cp-valprint.c (cp_print_value_fields): Call
	cp_print_static_field inside "try".

gdb/testsuite/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	PR c++/20020:
	* gdb.cp/constexpr-field.exp: New file.
	* gdb.cp/constexpr-field.cc: New file.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Add new GCC 9 warnings to warnings.m4
@ 2019-05-29 16:06 sergiodj+buildbot
  2019-05-29 16:08 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 16:06 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 33a6bc350f5b4f03d586ba9d32667b6fea1dce4a ***

Author: Tom Tromey <tromey@adacore.com>
Branch: master
Commit: 33a6bc350f5b4f03d586ba9d32667b6fea1dce4a

Add new GCC 9 warnings to warnings.m4

GCC 9 has a few new warnings that aren't enabled in the gdb build by
default: -Wdeprecated-copy, -Wdeprecated-copy-dtor, and
-Wredundant-move.  This patch enables them all.

Tested by rebuilding with a new GCC (git master) on x86-64 Fedora 29.

gdb/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	* inflow.c (struct terminal_info): Add default operator=.
	* configure: Rebuild.
	* warning.m4 (AM_GDB_WARNINGS): Add -Wdeprecated-copy,
	-Wdeprecated-copy-dtor, -Wredundant-move.

gdb/gdbserver/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	* configure: Rebuild.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Add "set print finish"
@ 2019-05-29 15:38 sergiodj+buildbot
  2019-05-29 15:44 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 15:38 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 000439d52897541ad00a84026ac471b4f8cb3c97 ***

Author: Tom Tromey <tromey@adacore.com>
Branch: master
Commit: 000439d52897541ad00a84026ac471b4f8cb3c97

Add "set print finish"

A user wanted to be able to disable the display of the value when
using "finish" -- but still have the value entered into the value
history in case it was useful later on.  Part of the rationale here is
that sometimes the value might be quite large, or expensive to display
(in their case this was compounded by a rogue pretty-printer).

This patch implements this idea.

gdb/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	* NEWS: Add entry.
	* infcmd.c (print_return_value_1): Handle finish_print
	option.
	(show_print_finish): New function.
	(_initialize_infcmd): Add "set/show print finish" commands.
	* valprint.c (user_print_options): Initialize new member.
	* valprint.h (struct value_print_options) <finish_print>: New
	member.

gdb/doc/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	* gdb.texinfo (Continuing and Stepping): Document new
	commands.

gdb/testsuite/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	* gdb.base/finish.exp (finish_no_print): New proc.
	(finish_tests): Call it.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Update release tools with libctf support.
@ 2019-05-29 13:07 sergiodj+buildbot
  2019-05-29 13:25 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 13:07 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT e33f2313bf63b77763739732be14b469b4b647b7 ***

Author: Nick Clifton <nickc@redhat.com>
Branch: master
Commit: e33f2313bf63b77763739732be14b469b4b647b7

Update release tools with libctf support.

top	* src-release.sh (do_proto_toplev): Add libctf to list of
	directories that can be disabled.

binutils* README-how-to-make-a-release: Add libctf to list of directories
	that need updates in their ChangeLogs.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Sync top level files with versions from gcc.
@ 2019-05-29 12:50 sergiodj+buildbot
  2019-05-29 13:24 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 12:50 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT f948b2de97884bfb4e5fc11d40a6bea9e0b096ae ***

Author: Nick Clifton <nickc@redhat.com>
Branch: master
Commit: f948b2de97884bfb4e5fc11d40a6bea9e0b096ae

Sync top level files with versions from gcc.

top	* Makefile.def (target_modules): Add libphobos.
	(flags_to_pass): Add GDC, GDCFLAGS, GDC_FOR_TARGET and
	GDCFLAGS_FOR_TARGET.
	(dependencies): Make libphobos depend on libatomic, libbacktrace
	configure, and zlib configure.
	(language): Add language d.
	* Makefile.in: Rebuild.
	* Makefile.tpl (BUILD_EXPORTS): Add GDC and GDCFLAGS.
	(HOST_EXPORTS): Add GDC.
	(POSTSTAGE1_HOST_EXPORTS): Add GDC and GDC_FOR_BUILD.
	(BASE_TARGET_EXPORTS): Add GDC.
	(GDC_FOR_BUILD, GDC, GDCFLAGS): New variables.
	(GDC_FOR_TARGET, GDC_FLAGS_FOR_TARGET): New variables.
	(EXTRA_HOST_FLAGS): Add GDC.
	(STAGE1_FLAGS_TO_PASS): Add GDC.
	(EXTRA_TARGET_FLAGS): Add GDC and GDCFLAGS.
	* config-ml.in: Treat GDC and GDCFLAGS like other compiler/flag
	environment variables.
	* configure: Rebuild.
	* configure.ac: Add target-libphobos to target_libraries.  Set and
	substitute GDC_FOR_BUILD and GDC_FOR_TARGET.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Do not build libctf for targets that do not use the ELF file format.
@ 2019-05-29 11:42 sergiodj+buildbot
  2019-05-29 11:44 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 11:42 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 90bd54236cb8b1c31c3662977159be971044c20d ***

Author: Nick Clifton <nickc@redhat.com>
Branch: master
Commit: 90bd54236cb8b1c31c3662977159be971044c20d

Do not build libctf for targets that do not use the ELF file format.

top	* configure.ac (noconfigdirs): Add libctf if the target does not use
	the ELF file format.
	* configure: Regenerate.

binutils* configure.ac (LIBCTF): Export.  Set to empty for non-ELF based
	targets.
	(HAVE_LIBCTF): Define if libctf support is available.
	* Makefile.am (LIBCTF): Set value to @LIBCTF@.
	* objdump.c: Make CTF code conditional upon HAVE_LIBCTF being
	defined.
	* readelf.c: Likewise.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Fix libctf build on non-ELF targets.
@ 2019-05-29 10:40 sergiodj+buildbot
  2019-05-29 10:52 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29 10:40 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 9698cf9b1c485edbbeabc9f65bfd0fdef92e3854 ***

Author: Nick Alcock <nick.alcock@oracle.com>
Branch: master
Commit: 9698cf9b1c485edbbeabc9f65bfd0fdef92e3854

Fix libctf build on non-ELF targets.

All machinery works as on ELF, except for automatic loading of ELF
string and symbol tables in the BFD-style open machinery.

        * Makefile.def (dependencies): configure-libctf depends on all-bfd
        and all its deps.
        * Makefile.in: Regenerated.

libctf/
        * configure.in: Check for bfd_section_from_elf_index.
        * configure: Regenerate.
        * config.h.in [HAVE_BFD_ELF]: Likewise.
        * libctf/ctf_open_bfd (ctf_bfdopen_ctfsect): Use it.
        abfd is potentially unused now.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] MIPS/LD: Skip overflow check for %pcrel_hi relocations
@ 2019-05-29  1:13 sergiodj+buildbot
  2019-05-29  3:24 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29  1:13 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 1e129bbefadbf09ace0fc7fcb3cfcda13700e3b8 ***

Author: Faraz Shahbazker <fshahbazker@wavecomp.com>
Branch: master
Commit: 1e129bbefadbf09ace0fc7fcb3cfcda13700e3b8

MIPS/LD: Skip overflow check for %pcrel_hi relocations

Overflow checks were removed for all hi16 relocations except PC-relative
high relocations per PR ld/16720.  Remove overflow checks from %pcrel_hi
relocations so that we can correctly handle negative offsets from PC.

bfd/
	* elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_PCHI16>:
	Remove overflow check.

ld/
	* testsuite/ld-mips-elf/undefweak-overflow.s: Remove test case
	for pcrel_hi/pcrel_lo.
	* testsuite/ld-mips-elf/undefweak-overflow.d: Update to match.
	* testsuite/ld-mips-elf/reloc-pcrel-r6.s: New test source.
	* testsuite/ld-mips-elf/reloc-pcrel-r6.d: New test linker script.
	* testsuite/ld-mips-elf/reloc-pcrel-r6.ld: New test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] x86: Add CheckRegSize to AVX512_BF16 instructions with Disp8ShiftVL
@ 2019-05-29  1:10 sergiodj+buildbot
  2019-05-29  3:14 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29  1:10 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT a2f4b66c9eb5210f8ef6038d7194af1e5f314f97 ***

Author: H.J. Lu <hjl.tools@gmail.com>
Branch: master
Commit: a2f4b66c9eb5210f8ef6038d7194af1e5f314f97

x86: Add CheckRegSize to AVX512_BF16 instructions with Disp8ShiftVL

For AVX512 instructions with Disp8ShiftVL and Broadcast, we may need to
add CheckRegSize to check if broadcast matches the destination register
size.

gas/

	PR gas/24625
	* testsuite/gas/i386/inval-avx512f.s: Add tests for AVX512_BF16
	instructions with invalid broadcast.
	* testsuite/gas/i386/x86-64-inval-avx512f.s: Likewise.
	* testsuite/gas/i386/inval-avx512f.l: Updated.
	* testsuite/gas/i386/x86-64-inval-avx512f.l: Likewise.

opcodes/

	PR gas/24625
	* i386-opc.tbl: Add CheckRegSize to AVX512_BF16 instructions with
	Disp8ShiftVL.
	* i386-tbl.h: Regenerated.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Remove find_old_style_renaming_symbol
@ 2019-05-29  1:04 sergiodj+buildbot
  2019-05-29  2:57 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29  1:04 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT c0e70c624fc7d89f5cf281350692de89a063786f ***

Author: Tom Tromey <tromey@adacore.com>
Branch: master
Commit: c0e70c624fc7d89f5cf281350692de89a063786f

Remove find_old_style_renaming_symbol

We found a case where a "bt" was very slow with Ada code.  Profiling
with callgrind showed this to be primarily due to calls to
find_old_style_renaming_symbol.  Because new-style renaming symbols
were implemented in 2007, it seems safe enough to remove this old
code.

A "-batch -ex bt" test on a large Ada program improves from:

    13.23user 0.57system 0:13.82elapsed 99%CPU (0avgtext+0avgdata 571408maxresident)k

to

    4.25user 0.48system 0:04.74elapsed 99%CPU (0avgtext+0avgdata 559844maxresident)k

with this patch.

Tested on x86-64 Fedora 29.  Joel reviewed this internally; and as it
is Ada-specific, I am checking it in.

gdb/ChangeLog
2019-05-28  Tom Tromey  <tromey@adacore.com>

	* ada-lang.c (ada_remove_Xbn_suffix)
	(find_old_style_renaming_symbol)
	(parse_old_style_renaming): Remove.
	(ada_find_renaming_symbol): Don't call
	find_old_style_renaming_symbol.
	(ada_is_renaming_symbol): Rename from
	ada_find_renaming_symbol.  Remove "block" parameter.  Return
	bool.  Now static.
	(ada_read_var_value): Update and simplify.
	* ada-exp.y (write_var_or_type): Remove old code.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Add libctf to top-level MAINTAINERS; add myself as CTF maintainer.
@ 2019-05-29  0:56 sergiodj+buildbot
  2019-05-29  2:57 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29  0:56 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 88981b157b08f2e9a404a2f86d4ee131f17ce3d4 ***

Author: Nick Alcock <nick.alcock@oracle.com>
Branch: master
Commit: 88981b157b08f2e9a404a2f86d4ee131f17ce3d4

Add libctf to top-level MAINTAINERS; add myself as CTF maintainer.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] libctf: build system
@ 2019-05-29  0:50 sergiodj+buildbot
  2019-05-29  2:31 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-29  0:50 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 0e65dfbaf3a0299e4837216a103c28625d4b4f1d ***

Author: Nick Alcock <nick.alcock@oracle.com>
Branch: master
Commit: 0e65dfbaf3a0299e4837216a103c28625d4b4f1d

libctf: build system

This ties libctf into the build system, and makes binutils depend on it
(used by the next commits).

	* Makefile.def (host_modules): Add libctf.
	* Makefile.def (dependencies): Likewise.
	libctf depends on zlib, libiberty, and bfd.
	* Makefile.in: Regenerated.
	* configure.ac (host_libs): Add libctf.
	* configure: Regenerated.

libctf/
	* Makefile.am: New.
	* Makefile.in: Regenerated.
	* config.h.in: Likewise.
	* aclocal.m4: Likewise.
	* configure: Likewise.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Fix style bug when paging
@ 2019-05-08 17:01 sergiodj+buildbot
  2019-05-08 17:31 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-05-08 17:01 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 99f20f08682ecc7be882774ff78409530802d000 ***

Author: Tom Tromey <tromey@adacore.com>
Branch: master
Commit: 99f20f08682ecc7be882774ff78409530802d000

Fix style bug when paging

Philippe pointed out a styling bug that would occur in some conditions
when paging:

    https://sourceware.org/ml/gdb-patches/2019-04/msg00101.html

I was finally able to reproduce this, and this patch fixes the bug.

The problem occurred when text overflowed the line, causing a
pagination prompt, but when no wrap column had been set.  In this
case, the current style was reset to show the prompt, but then not
reset back to the previously applied style before emitting the rest of
the line.

The fix is to record the applied style in this case, and re-apply it
afterward -- but only if the pager prompt was emitted, something that
the existing style.exp pointed out on the first, more naive, version
of the patch.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

	* utils.c (fputs_maybe_filtered): Reset style after paging, even
	when no wrap column is set.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Sync libiberty sources with master version in gcc repository. Updated stabs demangling and cxxfilt tests to match.
@ 2019-01-07 13:26 sergiodj+buildbot
  2019-01-07 13:34 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2019-01-07 13:26 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 053af8c9034f92d6e36a1180655ba22a65c56437 ***

Author: Nick Clifton <nickc@redhat.com>
Branch: master
Commit: 053af8c9034f92d6e36a1180655ba22a65c56437

Sync libiberty sources with master version in gcc repository.  Updated stabs demangling and cxxfilt tests to match.

	PR 24044
	* stabs.c (parse_stab_argtypes): Remove call to
	cplus_mangle_opcode.
	* testsuite/binutils-all/cxxfilt.exp: Replace tests of v2 encoding
	with v3 encoding.  Add escape for known failures.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Fix a crash in jit.c
@ 2018-12-28 23:52 sergiodj+buildbot
  2018-12-29  0:24 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-12-28 23:52 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 2cd8cc0b66ca297bce4d08e4f712f86d9f1a2fb6 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: 2cd8cc0b66ca297bce4d08e4f712f86d9f1a2fb6

Fix a crash in jit.c

A user at Mozilla pointed out a crash in jit.c.  In his situation, an
inferior using the JIT API exec'd an executable that did not use it.
This caused an assertion failure when jit.c:free_objfile_data called
delete_breakpoint with NULL.

This patch fixes the problem in the obvious way.  New test case
included.

gdb/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

	* jit.c (free_objfile_data): Only delete breakpoint if non-null.

gdb/testsuite/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>
	    Simon Marchi <simark@simark.ca>

	* gdb.base/jit-exec.exp: New file.
	* gdb.base/jit-exec.c: New file.
	* gdb.base/jit-execd.c: New file.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Document the "set style" commands
@ 2018-12-28 23:46 sergiodj+buildbot
  2018-12-29  0:13 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-12-28 23:46 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 140a4bc099820c909da0eac1df0f56ec468ad3dd ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: 140a4bc099820c909da0eac1df0f56ec468ad3dd

Document the "set style" commands

This documents the new "set style" commands.

gdb/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

	* NEWS: Mention terminal styling.

gdb/doc/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

	* gdb.texinfo (Output Styling): New node.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Highlight source code using GNU Source Highlight
@ 2018-12-28 23:31 sergiodj+buildbot
  2018-12-28 23:49 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-12-28 23:31 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 62f29fda90cf1d5a1899f57ef78452471c707fd6 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: 62f29fda90cf1d5a1899f57ef78452471c707fd6

Highlight source code using GNU Source Highlight

This changes gdb to highlight source using GNU Source Highlight, if it
is available.

This affects the output of the "list" command and also the TUI source
window.

No new test because I didn't see a way to make it work when Source
Highlight is not found.

gdb/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

	* utils.h (can_emit_style_escape): Declare.
	* utils.c (can_emit_style_escape): No longer static.
	* cli/cli-style.c (set_style_enabled): New function.
	(_initialize_cli_style): Use it.
	* tui/tui-winsource.c (tui_show_source_line): Use tui_puts.
	(tui_alloc_source_buffer): Change how source lines are allocated.
	* tui/tui-source.c (copy_source_line): New function.
	(tui_set_source_content): Use source cache.
	* tui/tui-io.h (tui_puts): Update.
	* tui/tui-io.c (tui_puts_internal): Add window parameter.
	(tui_puts): Likewise.
	(tui_redisplay_readline): Update.
	* tui/tui-data.c (free_content_elements): Change how source window
	contents are freed.
	* source.c (forget_cached_source_info): Clear the source cache.
	(print_source_lines_base): Use the source cache.
	* source-cache.h: New file.
	* source-cache.c: New file.
	* configure.ac: Check for GNU Source Highlight library.
	* configure: Update.
	* config.in: Update.
	* Makefile.in (SRCHIGH_LIBS, SRCHIGH_CFLAGS): New variables.
	(INTERNAL_CFLAGS_BASE): Add SRCHIGH_CFLAGS.
	(CLIBS): Add SRCHIGH_LIBS.
	(COMMON_SFILES): Add source-cache.c.
	(HFILES_NO_SRCDIR): Add source-cache.h.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Implement timestamp'ed output on "make check"
@ 2018-11-25 23:41 sergiodj+buildbot
  2018-11-25 23:45 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-11-25 23:41 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT f63c03b470036353c8c6c657e15f5ebd62ab67dd ***

Author: Sergio Durigan Junior <sergiodj@redhat.com>
Branch: master
Commit: f63c03b470036353c8c6c657e15f5ebd62ab67dd

Implement timestamp'ed output on "make check"

It is unfortunately not uncommon to have tests hanging on some of the
BuildBot workers.  For example, the ppc64be/ppc64le+gdbserver builders
are especially in a bad state when it comes to testing GDB/gdbserver,
and we can have builds that take an absurd amount of time to
finish (almost 1 week for one single build, for example).

It may be hard to diagnose these failures, because sometimes we don't
have access to the faulty systems, and other times we're just too busy
to wait and check which test is actually hanging.  During one of our
conversations about the topic, someone proposed that it would be a
good idea to have a timestamp put together with stdout output, so that
we can come back later and examine which tests are taking too long to
complete.

Here's my proposal to do this.  The very first thing I tried to do was
to use "ts(1)" to achieve this feature, and it obviously worked, but
the problem is that I'm afraid "ts(1)" may not be widely available on
every system we support.  Therefore, I decided to implement a *very*
simple version of "ts(1)", in Python 3, which basically does the same
thing: iterate over the stdin lines, and prepend a timestamp onto
them.

As for testsuite/Makefile.in, the user can now specify two new
variables to enable timestamp'ed output: TS (which enables the
output), and TS_FORMAT (optional, used to specify another timestamp
format according to "strftime").

Here's an example of how the output looks like:

  ...
  [Nov 22 17:07:19] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/call-strs.exp ...
  [Nov 22 17:07:19] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/step-over-no-symbols.exp ...
  [Nov 22 17:07:20] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/all-architectures-6.exp ...
  [Nov 22 17:07:20] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/hashline3.exp ...
  [Nov 22 17:07:20] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/max-value-size.exp ...
  [Nov 22 17:07:20] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/quit-live.exp ...
  [Nov 22 17:07:46] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/paginate-bg-execution.exp ...
  [Nov 22 17:07:56] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp ...
  [Nov 22 17:07:56] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/gcore-relro.exp ...
  [Nov 22 17:07:56] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/watchpoint-delete.exp ...
  [Nov 22 17:07:56] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp ...
  [Nov 22 17:07:56] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/vla-sideeffect.exp ...
  [Nov 22 17:07:57] [1234] Running binutils-gdb/gdb/testsuite/gdb.base/unload.exp ...
  ...

(What, gdb.base/quit-live.exp is taking 26 seconds to complete?!)

Output to stderr is not timestamp'ed, but I don't think that will be a
problem for us.  If it is, we can revisit the solution and extend it.

gdb/testsuite/ChangeLog:
2018-11-25  Sergio Durigan Junior  <sergiodj@redhat.com>

	* Makefile.in (TIMESTAMP): New variable.
	(check-single): Add $(TIMESTAMP) to the end of $(DO_RUNTEST)
	command.
	(check-single-racy): Likewise.
	(check/%.exp): Likewise.
	(check-racy/%.exp): Likewise.
	(workers/%.worker): Likewise.
	(build-perf): Likewise.
	(check-perf): Likewise.
	* README: Describe new "TS" and "TS_FORMAT" variables.
	* print-ts.py: New file.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Remove obsolete comments from field_fmt
@ 2018-11-25 23:04 sergiodj+buildbot
  2018-11-25 23:12 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-11-25 23:04 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT b5b12e1dbe0f2739624f91621828df73ef55e900 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: b5b12e1dbe0f2739624f91621828df73ef55e900

Remove obsolete comments from field_fmt

This removes some comments that I believe were made obsolete by the
recent change to cli_ui_out::do_field_fmt.  The comment in mi_ui_out
probably was just copy/paste, because I think aligning never made
sense in an MI context.

gdb/ChangeLog
2018-11-25  Tom Tromey  <tom@tromey.com>

	* ui-out.c (ui_out::field_fmt): Remove comment.
	* tui/tui-out.c (tui_ui_out::do_field_fmt): Remove comment.
	* mi/mi-out.c (mi_ui_out::do_field_fmt): Remove comment.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Re-fix leak in source.c (open_source_file).
@ 2018-11-24 12:23 sergiodj+buildbot
  2018-11-24 12:43 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-11-24 12:23 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 5446094655df842abb4ababac39f34c6342e8da3 ***

Author: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Branch: master
Commit: 5446094655df842abb4ababac39f34c6342e8da3

Re-fix leak in source.c (open_source_file).

Leak fixed in '8e6a5953e1d Fix 4K leak in open_source_file' has been partially
undone by '2179fbc36d23 Return scoped_fd from open_source_file'. Re-add the
transfer of current s->fullname to the unique_xmalloc_ptr fullname given to
find_and_open_source.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] gdbserver: AArch64: Remove cannot_fetch/store_register
@ 2018-11-23 14:34 sergiodj+buildbot
  2018-11-23 14:59 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-11-23 14:34 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 5013824590f59374106007d4c9724d5767911d75 ***

Author: Alan Hayward <alan.hayward@arm.com>
Branch: master
Commit: 5013824590f59374106007d4c9724d5767911d75

gdbserver: AArch64: Remove cannot_fetch/store_register

The cannot store/fetch register functions are only used for checking
if a register can be accessed using PEEKUSER/POKEUSER.
The AArch64 port doesn't support this method of access, so remove the
unused functions.

gdb/gdbserver:
	* linux-aarch64-low.c (aarch64_cannot_store_register): Remove.
	(aarch64_cannot_fetch_register): Likewise.
	(struct linux_target_ops): Update references.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Remove declarations of is_running/is_stopped/is_exited
@ 2018-11-23 14:22 sergiodj+buildbot
  2018-11-23 14:22 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-11-23 14:22 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 6af05e645ab7fbbb4e0b663f50febf052e6d09a0 ***

Author: Pedro Alves <palves@redhat.com>
Branch: master
Commit: 6af05e645ab7fbbb4e0b663f50febf052e6d09a0

Remove declarations of is_running/is_stopped/is_exited

The recent commit 080363310650 ("Per-inferior thread list, thread
ranges/iterators, down with ALL_THREADS, etc.") removed the
definitions of is_running/is_stopped/is_exited but missed removing the
declarations.

gdb/ChangeLog:
2018-11-23  Pedro Alves  <palves@redhat.com>

	* gdbthread.h (enum thread_state): Move comments here.
	(is_running, is_stopped, is_exited): Remove declarations.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc.
@ 2018-11-22 16:58 sergiodj+buildbot
  2018-11-22 17:23 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-11-22 16:58 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 080363310650c93ad8e93018bcb6760ba5d32d1c ***

Author: Pedro Alves <palves@redhat.com>
Branch: master
Commit: 080363310650c93ad8e93018bcb6760ba5d32d1c

Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc.

As preparation for multi-target, this patch makes each inferior have
its own thread list.

This isn't absolutely necessary for multi-target, but simplifies
things.  It originally stemmed from the desire to eliminate the
init_thread_list calls sprinkled around, plus it makes it more
efficient to iterate over threads of a given inferior (no need to
always iterate over threads of all inferiors).

We still need to iterate over threads of all inferiors in a number of
places, which means we'd need adjust the ALL_THREADS /
ALL_NON_EXITED_THREADS macros.  However, naively tweaking those macros
to have an extra for loop, like:

     #define ALL_THREADS (thr, inf) \
       for (inf = inferior_list; inf; inf = inf->next) \
	 for (thr = inf->thread_list; thr; thr = thr->next)

causes problems with code that does "break" or "continue" within the
ALL_THREADS loop body.  Plus, we need to declare the extra "inf" local
variable in order to pass it as temporary variable to ALL_THREADS
(etc.)

It gets even trickier when we consider extending the macros to filter
out threads matching a ptid_t and a target.  The macros become tricker
to read/write.  Been there.

An alternative (which was my next attempt), is to replace the
ALL_THREADS etc. iteration style with for_each_all_threads,
for_each_non_exited_threads, etc. functions which would take a
callback as parameter, which would usually be passed a lambda.
However, I did not find that satisfactory at all, because the
resulting code ends up a little less natural / more noisy to read,
write and debug/step-through (due to use of lambdas), and in many
places where we use "continue;" to skip to the next thread now need to
use "return;".  (I ran into hard to debug bugs caused by a
continue/return confusion.)

I.e., before:

    ALL_NON_EXITED_THREADS (tp)
      {
	if (tp->not_what_I_want)
	  continue;
	// do something
      }

would turn into:

    for_each_non_exited_thread ([&] (thread_info *tp)
      {
	if (tp->not_what_I_want)
	  return;
	// do something
      });

Lastly, the solution I settled with was to replace the ALL_THREADS /
ALL_NON_EXITED_THREADS / ALL_INFERIORS macros with (C++20-like) ranges
and iterators, such that you can instead naturaly iterate over
threads/inferiors using range-for, like e.g,.:

   // all threads, including THREAD_EXITED threads.
   for (thread_info *tp : all_threads ())
     { .... }

   // all non-exited threads.
   for (thread_info *tp : all_non_exited_threads ())
     { .... }

   // all non-exited threads of INF inferior.
   for (thread_info *tp : inf->non_exited_threads ())
     { .... }

The all_non_exited_threads() function takes an optional filter ptid_t as
parameter, which is quite convenient when we need to iterate over
threads matching that filter.  See e.g., how the
set_executing/set_stop_requested/finish_thread_state etc. functions in
thread.c end up being simplified.

Most of the patch thus is about adding the infrustructure for allowing
the above.  Later on when we get to actual multi-target, these
functions/ranges/iterators will gain a "target_ops *" parameter so
that e.g., we can iterate over all threads of a given target that
match a given filter ptid_t.

The only entry points users needs to be aware of are the
all_threads/all_non_exited_threads etc. functions seen above.  Thus,
those functions are declared in gdbthread.h/inferior.h.  The actual
iterators/ranges are mainly "internals" and thus are put out of view
in the new thread-iter.h/thread-iter.c/inferior-iter.h files.  That
keeps the gdbthread.h/inferior.h headers quite a bit more readable.

A common/safe-iterator.h header is added which adds a template that
can be used to build "safe" iterators, which are forward iterators
that can be used to replace the ALL_THREADS_SAFE macro and other
instances of the same idiom in future.

There's a little bit of shuffling of code between
gdbthread.h/thread.c/inferior.h in the patch.  That is necessary in
order to avoid circular dependencies between the
gdbthread.h/inferior.h headers.

As for the init_thread_list calls sprinkled around, they're all
eliminated by this patch, and a new, central call is added to
inferior_appeared.  Note how also related to that, there's a call to
init_wait_for_inferior in remote.c that is eliminated.
init_wait_for_inferior is currently responsible for discarding skipped
inline frames, which had to be moved elsewhere.  Given that nowadays
we always have a thread even for single-threaded processes, the
natural place is to delete a frame's inline frame info when we delete
the thread.  I.e., from clear_thread_inferior_resources.

gdb/ChangeLog:
2018-11-22  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMMON_SFILES): Add thread-iter.c.
	* breakpoint.c (breakpoints_should_be_inserted_now): Replace
	ALL_NON_EXITED_THREADS with all_non_exited_threads.
	(print_one_breakpoint_location): Replace ALL_INFERIORS with
	all_inferiors.
	* bsd-kvm.c: Include inferior.h.
	* btrace.c (btrace_free_objfile): Replace ALL_NON_EXITED_THREADS
	with all_non_exited_threads.
	* common/filtered-iterator.h: New.
	* common/safe-iterator.h: New.
	* corelow.c (core_target_open): Don't call init_thread_list here.
	* darwin-nat.c (thread_info_from_private_thread_info): Replace
	ALL_THREADS with all_threads.
	* fbsd-nat.c (fbsd_nat_target::resume): Replace
	ALL_NON_EXITED_THREADS with inf->non_exited_threads.
	* fbsd-tdep.c (fbsd_make_corefile_notes): Replace
	ALL_NON_EXITED_THREADS with inf->non_exited_threads.
	* fork-child.c (postfork_hook): Don't call init_thread_list here.
	* gdbarch-selftests.c (register_to_value_test): Adjust.
	* gdbthread.h: Don't include "inferior.h" here.
	(struct inferior): Forward declare.
	(enum step_over_calls_kind): Moved here from inferior.h.
	(thread_info::deletable): Definition moved to thread.c.
	(find_thread_ptid (inferior *, ptid_t)): Declare.
	(ALL_THREADS, ALL_THREADS_BY_INFERIOR, ALL_THREADS_SAFE): Delete.
	Include "thread-iter.h".
	(all_threads, all_non_exited_threads, all_threads_safe): New.
	(any_thread_p): Declare.
	(thread_list): Delete.
	* infcmd.c (signal_command): Replace ALL_NON_EXITED_THREADS with
	all_non_exited_threads.
	(proceed_after_attach_callback): Delete.
	(proceed_after_attach): Take an inferior pointer instead of an
	integer PID.  Adjust to use range-for.
	(attach_post_wait): Pass down inferior pointer instead of pid.
	Use range-for instead of ALL_NON_EXITED_THREADS.
	(detach_command): Remove init_thread_list call.
	* inferior-iter.h: New.
	* inferior.c (struct delete_thread_of_inferior_arg): Delete.
	(delete_thread_of_inferior): Delete.
	(delete_inferior, exit_inferior_1): Use range-for with
	inf->threads_safe() instead of iterate_over_threads.
	(inferior_appeared): Call init_thread_list here.
	(discard_all_inferiors): Use all_non_exited_inferiors.
	(find_inferior_id, find_inferior_pid): Use all_inferiors.
	(iterate_over_inferiors): Use all_inferiors_safe.
	(have_inferiors, number_of_live_inferiors): Use
	all_non_exited_inferiors.
	(number_of_inferiors): Use all_inferiors and std::distance.
	(print_inferior): Use all_inferiors.
	* inferior.h: Include gdbthread.h.
	(enum step_over_calls_kind): Moved to gdbthread.h.
	(struct inferior) <thread_list>: New field.
	<threads, non_exited_threads, threads_safe>: New methods.
	(ALL_INFERIORS): Delete.
	Include "inferior-iter.h".
	(ALL_NON_EXITED_INFERIORS): Delete.
	(all_inferiors_safe, all_inferiors, all_non_exited_inferiors): New
	functions.
	* inflow.c (child_interrupt, child_pass_ctrlc): Replace
	ALL_NON_EXITED_THREADS with all_non_exited_threads.
	* infrun.c (follow_exec): Use all_threads_safe.
	(clear_proceed_status, proceed): Use all_non_exited_threads.
	(init_wait_for_inferior): Don't clear inline frame state here.
	(infrun_thread_stop_requested, for_each_just_stopped_thread): Use
	all_threads instead of ALL_NON_EXITED_THREADS.
	(random_pending_event_thread): Use all_non_exited_threads instead
	of ALL_NON_EXITED_THREADS.  Use a lambda for repeated code.
	(clean_up_just_stopped_threads_fsms): Use all_non_exited_threads
	instead of ALL_NON_EXITED_THREADS.
	(handle_no_resumed): Use all_non_exited_threads instead of
	ALL_NON_EXITED_THREADS.  Use all_inferiors instead of
	ALL_INFERIORS.
	(restart_threads, switch_back_to_stepped_thread): Use
	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
	* linux-nat.c (check_zombie_leaders): Replace ALL_INFERIORS with
	all_inferiors.
	(kill_unfollowed_fork_children): Use inf->non_exited_threads
	instead of ALL_NON_EXITED_THREADS.
	* linux-tdep.c (linux_make_corefile_notes): Use
	inf->non_exited_threads instead of ALL_NON_EXITED_THREADS.
	* linux-thread-db.c (thread_db_target::update_thread_list):
	Replace ALL_INFERIORS with all_inferiors.
	(thread_db_target::thread_handle_to_thread_info): Use
	inf->non_exited_threads instead of ALL_NON_EXITED_THREADS.
	* mi/mi-interp.c (multiple_inferiors_p): New.
	(mi_on_resume_1): Simplify using all_non_exited_threads and
	multiple_inferiors_p.
	* mi/mi-main.c (mi_cmd_thread_list_ids): Use all_non_exited_threads
	instead of ALL_NON_EXITED_THREADS.
	* nto-procfs.c (nto_procfs_target::open): Don't call
	init_thread_list here.
	* record-btrace.c (record_btrace_target_open)
	(record_btrace_target::stop_recording)
	(record_btrace_target::close)
	(record_btrace_target::record_is_replaying)
	(record_btrace_target::resume, record_btrace_target::wait)
	(record_btrace_target::record_stop_replaying): Use
	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
	* record-full.c (record_full_wait_1): Use all_non_exited_threads
	instead of ALL_NON_EXITED_THREADS.
	* regcache.c (cooked_read_test): Remove reference to global
	thread_list.
	* remote-sim.c (gdbsim_target::create_inferior): Don't call
	init_thread_list here.
	* remote.c (remote_target::update_thread_list): Use
	all_threads_safe instead of ALL_NON_EXITED_THREADS.
	(remote_target::process_initial_stop_replies): Replace
	ALL_INFERIORS with all_non_exited_inferiors and use
	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
	(remote_target::open_1): Don't call init_thread_list here.
	(remote_target::append_pending_thread_resumptions)
	(remote_target::remote_resume_with_hc): Use all_non_exited_threads
	instead of ALL_NON_EXITED_THREADS.
	(remote_target::commit_resume)
	(remote_target::remove_new_fork_children): Replace ALL_INFERIORS
	with all_non_exited_inferiors and use all_non_exited_threads
	instead of ALL_NON_EXITED_THREADS.
	(remote_target::kill_new_fork_children): Use
	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.  Remove
	init_thread_list and init_wait_for_inferior calls.
	(remote_target::remote_btrace_maybe_reopen)
	(remote_target::thread_handle_to_thread_info): Use
	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
	* target.c (target_terminal::restore_inferior)
	(target_terminal_is_ours_kind): Replace ALL_INFERIORS with
	all_non_exited_inferiors.
	* thread-iter.c: New file.
	* thread-iter.h: New file.
	* thread.c: Include "inline-frame.h".
	(thread_list): Delete.
	(clear_thread_inferior_resources): Call clear_inline_frame_state.
	(init_thread_list): Use all_threads_safe instead of
	ALL_THREADS_SAFE.  Adjust to per-inferior thread lists.
	(new_thread): Adjust to per-inferior thread lists.
	(add_thread_silent): Pass inferior to find_thread_ptid.
	(thread_info::deletable): New, moved from the header.
	(delete_thread_1): Adjust to per-inferior thread lists.
	(find_thread_global_id): Use inf->threads().
	(find_thread_ptid): Use find_inferior_ptid and pass inferior to
	find_thread_ptid.
	(find_thread_ptid(inferior*, ptid_t)): New overload.
	(iterate_over_threads): Use all_threads_safe.
	(any_thread_p): New.
	(thread_count): Use all_threads and std::distance.
	(live_threads_count): Use all_non_exited_threads and
	std::distance.
	(valid_global_thread_id): Use all_threads.
	(in_thread_list): Use find_thread_ptid.
	(first_thread_of_inferior): Adjust to per-inferior thread lists.
	(any_thread_of_inferior, any_live_thread_of_inferior): Use
	inf->non_exited_threads().
	(prune_threads, delete_exited_threads): Use all_threads_safe.
	(thread_change_ptid): Pass inferior pointer to find_thread_ptid.
	(set_resumed, set_running): Use all_non_exited_threads.
	(is_thread_state, is_stopped, is_exited, is_running)
	(is_executing): Delete.
	(set_executing, set_stop_requested, finish_thread_state): Use
	all_non_exited_threads.
	(print_thread_info_1): Use all_inferiors and all_threads.
	(thread_apply_all_command): Use all_non_exited_threads.
	(thread_find_command): Use all_threads.
	(update_threads_executing): Use all_non_exited_threads.
	* tid-parse.c (parse_thread_id): Use inf->threads.
	* x86-bsd-nat.c (x86bsd_dr_set): Use inf->non_exited_threads ().


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Avoid "Invalid parameter passed to C runtime function" warning
@ 2018-11-20 16:57 sergiodj+buildbot
  2018-11-20 17:04 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-11-20 16:57 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 970d89d8fdd84b31decaf3bd84e785aad057ea32 ***

Author: Eli Zaretskii <eliz@gnu.org>
Branch: master
Commit: 970d89d8fdd84b31decaf3bd84e785aad057ea32

Avoid "Invalid parameter passed to C runtime function" warning

This warning was displayed by OutputDebugString on MinGW when
GDB was being debugged natively.

gdb/ChangeLog:

	* common/filestuff.c (gdb_fopen_cloexec): Disable use of "e" mode
	with 'fopen' also if O_CLOEXEC is equal to O_NOINHERIT, to cater
	to MinGW fixed by Gnulib.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] GDB: Only build for "unix:" connections if AF_LOCAL is supported.
@ 2018-10-29  8:20 sergiodj+buildbot
  2018-10-29 10:11 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-29  8:20 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 98a17ece013cb94cd602496b9efb92b8816b3953 ***

Author: John Darrington <john@darrington.wattle.id.au>
Branch: master
Commit: 98a17ece013cb94cd602496b9efb92b8816b3953

GDB: Only build for "unix:" connections if AF_LOCAL is supported.

Commit f19c7ff839d7a32ebb48482ae7d318fb46ca823d added a new member to the
prefixes array which included a use of the symbol AF_LOCAL.   Unfortunately,
not all systems declare this symbol.    This change only compiles the "unix:"
member if the system knows about AF_LOCAL.

gdb/ChangeLog:

* configure.ac: New test HAVE_AF_LOCAL
* common/netstuff.c (parse_connection_spec) [prefixes]: Only compile "unix:"
   if HAVE_AF_LOCAL is true.
* configure: regenerate.
* config.in: regenerate.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] gdb/riscv: Add back missing braces in riscv-linux-nat.c
@ 2018-10-28 11:12 sergiodj+buildbot
  2018-10-28 12:11 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-28 11:12 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT a3d7226832e5750211ec300c5929dc0f035a3661 ***

Author: Andrew Burgess <andrew.burgess@embecosm.com>
Branch: master
Commit: a3d7226832e5750211ec300c5929dc0f035a3661

gdb/riscv: Add back missing braces in riscv-linux-nat.c

In this commit:

    commit ee67fd7f3f6ca78eede2862e309c0bcf266bbd7e
    Date:   Thu Oct 25 12:03:31 2018 +0100

        gdb/riscv: Use correct regnum in riscv_linux_nat_target::fetch_registers

I incorrectly removed a set of braces in violation of the GDB coding
standard.  This commit adds them back.

gdb/ChangeLog:

	* riscv-linux-nat.c (riscv_linux_nat_target::fetch_registers):
	Add missing braces.  No functional change.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] OBVIOUS Use report_unrecognized_option_error in 'demangle' and 'info macro' commands.
@ 2018-10-27 20:36 sergiodj+buildbot
  2018-10-27 21:32 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-27 20:36 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT cd948f5b2be612b784591dbe438dc518f6b80d61 ***

Author: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Branch: master
Commit: cd948f5b2be612b784591dbe438dc518f6b80d61

OBVIOUS Use report_unrecognized_option_error in 'demangle' and 'info macro' commands.

Rather than have some local logic to throw an error for an unrecognized option,
use the new cli-utils.h function throwing an error.

At the same time, fix some wrong indentation in info_macro_command
and fix a small bug in 'demangle' error handling:

Without the patch:
  (gdb) demangle -L c++ abcd
  Unrecognized option 'c++' to demangle command.  Try "help demangle".
  (gdb)

With the patch:
  (gdb) demangle -L c++ abcd
  Unrecognized option '-L' to demangle command.  Try "help demangle".

2018-10-27  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* macrocmd.c (info_macro_command): Use report_unrecognized_option_error
	to report a bad option and fix indentation.
	* demangle.c (demangle_command): Use report_unrecognized_option_error
	to report a bad option and correctly report the bad option.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Cache a copy of the user's shell on macOS
@ 2018-10-27 18:36 sergiodj+buildbot
  2018-10-27 19:08 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-27 18:36 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT b50a8b9a916ea2fe1379bcd8f122feef8129a0e9 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: b50a8b9a916ea2fe1379bcd8f122feef8129a0e9

Cache a copy of the user's shell on macOS

Recent versions of macOS have a feature called System Integrity
Protection.  Among other things, This feature prevents ptrace from
tracing certain programs --- for example, the programs in /bin, which
includes typical shells.

This means that startup-with-shell does not work properly.  This is PR
cli/23364.  Currently there is a workaround in gdb to disable
startup-with-shell when this feature might be in use.

This patch changes gdb to be a bit more precise about when
startup-with-shell will not work, by checking whether the shell
executable is restricted.

If the shell is restricted, then this patch will also cause gdb to
cache a copy of the shell in the gdb cache directory, and then reset
the SHELL environment variable to point to this copy.  This lets
startup-with-shell work again.

Tested on High Sierra by trying to start a program using redirection,
and by running startup-with-shell.exp.

gdb/ChangeLog
2018-10-27  Tom Tromey  <tom@tromey.com>

	PR cli/23364:
	* darwin-nat.c (copied_shell): New global.
	(may_have_sip): Rename from should_disable_startup_with_shell.
	(copy_shell_to_cache, maybe_cache_shell): New functions.
	(darwin_nat_target::create_inferior): Update.  Use
	copied_shell.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Do not reopen temporary files
@ 2018-10-27 18:30 sergiodj+buildbot
  2018-10-27 19:03 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-27 18:30 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 36033ef57cd048588f9a3d5523712147066421f2 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: 36033ef57cd048588f9a3d5523712147066421f2

Do not reopen temporary files

The current callers of mkostemp close the file descriptor and then
re-open it with fopen.  It seemed better to me to continue to use the
already-opened file descriptor, so this patch rearranges the code a
little in order to do so.  It takes care to ensure that the files are
only unlinked after the file descriptor in question is closed, as
before.

gdb/ChangeLog
2018-10-27  Tom Tromey  <tom@tromey.com>

	* unittests/scoped_fd-selftests.c (test_to_file): New function.
	(run_tests): Call test_to_file.
	* dwarf-index-write.c (write_psymtabs_to_index): Do not reopen
	temporary files.
	* common/scoped_fd.h (scoped_fd::to_file): New method.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Use mkostemp, not mkstemp
@ 2018-10-27 18:24 sergiodj+buildbot
  2018-10-27 18:44 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-27 18:24 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT b3279b601e67ce47263082ef86cfc86e25607c5e ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: b3279b601e67ce47263082ef86cfc86e25607c5e

Use mkostemp, not mkstemp

I noticed that gdb could leak file descriptors coming from mkstemp.
This patch fixes the problem by importing the gnulib mkostemp instead,
and then changing gdb to pass O_CLOEXEC.

A small gnulib patch was needed.  This has already been accepted
upstream.

gdb/ChangeLog
2018-10-27  Tom Tromey  <tom@tromey.com>

	* unittests/scoped_mmap-selftests.c (test_normal): Use
	gdb_mkostemp_cloexec.
	* unittests/scoped_fd-selftests.c (test_destroy, test_release):
	Use gdb_mkostemp_cloexec.
	* gnulib/aclocal-m4-deps.mk, gnulib/aclocal.m4,
	gnulib/config.in, gnulib/configure,
	gnulib/import/Makefile.am, gnulib/import/Makefile.in,
	gnulib/import/m4/gnulib-cache.m4,
	gnulib/import/m4/gnulib-comp.m4: Update.
	* gnulib/import/m4/mkostemp.m4: New file.
	* gnulib/import/m4/mkstemp.m4: Remove.
	* gnulib/import/mkostemp.c: New file.
	* gnulib/import/mkstemp.m4: Remove.
	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Remove
	mkstemp, add mkostemp.  Apply new patch.
	* gnulib/import/stdlib.in.h: Apply patch.
	* gnulib/patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch:
	New file.
	* dwarf-index-write.c (write_psymtabs_to_index): Use
	gdb_mkostemp_cloexec.
	* common/filestuff.h (gdb_mkostemp_cloexec): New function.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Move mkdir_recursive to common/filestuff.c
@ 2018-10-27 18:18 sergiodj+buildbot
  2018-10-27 18:29 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-27 18:18 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT e418a61a67a3476826259163383e5deb661042cc ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: e418a61a67a3476826259163383e5deb661042cc

Move mkdir_recursive to common/filestuff.c

This moves mkdir_recursive from dwarf-index-cache.c to
common/filestuff.c, and also changes it to return a boolean that says
whether or not it worked.

gdb/ChangeLog
2018-10-27  Tom Tromey  <tom@tromey.com>

	* unittests/mkdir-recursive-selftests.c: New file.
	* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
	unittests/mkdir-recursive-selftests.c.
	* dwarf-index-cache.c (mkdir_recursive): Move to
	common/filestuff.c.
	(index_cache::store): Check return value of mkdir_recursive.
	(create_dir_and_check, test_mkdir_recursive): Move to new file.
	(_initialize_index_cache): Don't register test.
	* common/filestuff.h (mkdir_recursive): Declare.
	* common/filestuff.c (mkdir_recursive): Move from
	dwarf-index-cache.c.  Return bool.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Move make_temp_filename to common/pathstuff.c
@ 2018-10-27 18:16 sergiodj+buildbot
  2018-10-27 18:19 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-27 18:16 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 29be4d9dee1263b36e33421dd8ea69b9b7308391 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: 29be4d9dee1263b36e33421dd8ea69b9b7308391

Move make_temp_filename to common/pathstuff.c

Currently make_temp_filename is a function local to
write_psymtabs_to_index.  This patch moves it to pathstuff.c so that
it can be used from other places in gdb.

gdb/ChangeLog
2018-10-27  Tom Tromey  <tom@tromey.com>

	* dwarf-index-write.c (write_psymtabs_to_index): Move
	make_temp_filename to common/pathstuff.c.
	* common/pathstuff.h (make_temp_filename): Declare.
	* common/pathstuff.c (make_temp_filename): New function, moved
	from dwarf-index-write.c.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Unify shell-finding logic
@ 2018-10-27 18:10 sergiodj+buildbot
  2018-10-27 18:15 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-27 18:10 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 974e68446388769f023c6c9bfb1e67ed75199618 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: 974e68446388769f023c6c9bfb1e67ed75199618

Unify shell-finding logic

I noticed several places in gdb that were using getenv("SHELL") and
then falling back to "/bin/sh" if it returned NULL.  This unifies
these into a single function.

gdb/ChangeLog
2018-10-27  Tom Tromey  <tom@tromey.com>

	* procfs.c (procfs_target::create_inferior): Use get_shell.
	* cli/cli-cmds.c (shell_escape): Use get_shell.
	* windows-nat.c (windows_nat_target::create_inferior): Use
	get_shell.
	* common/pathstuff.c (get_shell): New function.
	* nat/fork-inferior.c (SHELL_FILE, get_startup_shell): Remove.
	(fork_inferior): Use get_shell.
	* common/pathstuff.h (get_shell): Declare.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Add native target for FreeBSD/riscv.
@ 2018-10-08 22:07 sergiodj+buildbot
  2018-10-08 22:18 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-08 22:07 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 74792ff782431ec6113b9a8a8e85b95f46094c7f ***

Author: John Baldwin <jhb@FreeBSD.org>
Branch: master
Commit: 74792ff782431ec6113b9a8a8e85b95f46094c7f

Add native target for FreeBSD/riscv.

gdb/ChangeLog:

	* Makefile.in (ALLDEPFILES): Add riscv-fbsd-nat.c.
	* NEWS: Mention new FreeBSD/riscv native configuration.
	* configure.host: Add riscv*-*-freebsd*.
	* configure.nat: Likewise.
	* riscv-fbsd-nat.c: New file.

gdb/doc/ChangeLog:

	* gdb.texinfo (Contributors): Add SRI International and University
	of Cambridge for FreeBSD/riscv.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Add FreeBSD/riscv architecture.
@ 2018-10-08 22:02 sergiodj+buildbot
  2018-10-08 22:09 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-08 22:02 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT ed65e20bc7cd18406081cf5ba29f9c9bccd4e52f ***

Author: John Baldwin <jhb@FreeBSD.org>
Branch: master
Commit: ed65e20bc7cd18406081cf5ba29f9c9bccd4e52f

Add FreeBSD/riscv architecture.

Support for collecting and supplying general purpose and floating
point register sets is provided along with signal frame unwinding.

FreeBSD only supports RV64 currently, so while some provision is made
for RV32 in the general-purpose register set, the changes have only
been tested on RV64.

gdb/ChangeLog:

	* Makefile.in (ALL_TARGET_OBS): Add riscv-fbsd-tdep.o.
	(HFILES_NO_SRCDIR): Add riscv-fbsd-tdep.h.
	(ALLDEPFILES): Add riscv-fbsd-tdep.c.
	* NEWS: Mention new FreeBSD/riscv target.
	* configure.tgt: Add riscv*-*-freebsd*.
	* riscv-fbsd-tdep.c: New file.
	* riscv-fbsd-tdep.h: New file.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Add a helper function to trad_frame to support register cache maps.
@ 2018-10-08 21:57 sergiodj+buildbot
  2018-10-08 22:01 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-08 21:57 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 498f740792fe0edd2955c5cee6bb864f60a5b173 ***

Author: John Baldwin <jhb@FreeBSD.org>
Branch: master
Commit: 498f740792fe0edd2955c5cee6bb864f60a5b173

Add a helper function to trad_frame to support register cache maps.

Currently, signal frame handlers require explicitly coded calls to
trad_frame_set_reg_addr() to describe the location of saved registers
within a signal frame.  This change permits the regcache_map_entry
arrays used with regcache::supply_regset and regcache::collect_regset
to be used to describe a block of saved registers given an initial
address for the register block.

Some systems use the same layout for registers in core dump notes,
native register sets with ptrace(), and the register contexts saved in
signal frames.  On these systems, a single register map can now be
used to describe the layout of registers in all three places.

If a register map entry's size does not match the native size of a
register, try to match the semantics used by
regcache::transfer_regset.  If a register slot is too large, assume
that the register's value is stored in the first N bytes and ignore
the remaning bytes.  If the register slot is smaller than the
register, assume the slot holds the low N bytes of the register's
value.  Read these low N bytes from the target and zero-extend them to
generate a register value.

While here, document the semantics for both regcache::transfer_regset
and trad_frame with respect to register slot's whose size does not
match the register's size.

gdb/ChangeLog:

	* regcache.h (struct regcache_map_entry): Note that this type can
	be used with traditional frame caches.
	* trad-frame.c (trad_frame_set_reg_regmap): New.
	* trad-frame.h (trad_frame_set_reg_regmap): New.


^ permalink raw reply	[flat|nested] 70+ messages in thread
* [binutils-gdb] Finding data member in virtual base class
@ 2018-10-08 21:42 sergiodj+buildbot
  2018-10-08 21:46 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 70+ messages in thread
From: sergiodj+buildbot @ 2018-10-08 21:42 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 9f6b697b0efd4ba4e2cb21ac17d2b18a23f81abd ***

Author: Weimin Pan <weimin.pan@oracle.com>
Branch: master
Commit: 9f6b697b0efd4ba4e2cb21ac17d2b18a23f81abd

Finding data member in virtual base class

This patch fixes the original problem - printing member in a virtual base,
using various expressions, do not yield the same value. Simple test case
below demonstrates the problem:

% cat t.cc
struct base { int i; };
typedef base tbase;
struct derived: virtual tbase { void func() { } };
int main() { derived().func(); }
% g++ -g t.cc
% gdb a.out
(gdb) break derived::func
(gdb) run
(gdb) p i
$1 = 0
(gdb) p base::i
$3 = 0
(gdb) p derived::i
$4 = 4196392

To fix the problem, add function get_baseclass_offset() which searches
recursively for the base class along the class hierarchy. If the base
is virtual, it uses "vptr" in virtual class object, which indexes to
its derived class's vtable, to get and returns the baseclass offset.
If the base is non-virtual, it returns the accumulated offset of its
parent classes. The offset is then added to the address of the class
object to access its member in value_struct_elt_for_reference().


^ permalink raw reply	[flat|nested] 70+ messages in thread

end of thread, other threads:[~2020-02-24  3:18 UTC | newest]

Thread overview: 70+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 17:24 [binutils-gdb] Fix failure in gdb.ada/complete.exp sergiodj+buildbot
2019-05-29 17:37 ` *** COMPILATION FAILED *** Failures on Solaris11-sparcv9-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 17:37 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, " sergiodj+buildbot
2019-05-29 18:33 ` Failures on RHEL-s390x-m64, branch master sergiodj+buildbot
2019-05-29 18:36 ` *** COMPILATION FAILED *** Failures on NetBSD-x86_64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-30 20:28 ` Failures on Fedora-x86_64-m32, branch master sergiodj+buildbot
2019-05-30 20:45 ` Failures on Fedora-x86_64-native-gdbserver-m32, " sergiodj+buildbot
2019-05-30 21:04 ` Failures on Fedora-x86_64-cc-with-index, " sergiodj+buildbot
2019-05-30 21:08 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " sergiodj+buildbot
2019-05-30 21:25 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " sergiodj+buildbot
2019-05-30 21:28 ` Failures on Fedora-x86_64-native-gdbserver-m64, " sergiodj+buildbot
2019-05-30 21:37 ` Failures on Fedora-i686, " sergiodj+buildbot
2019-05-30 21:42 ` Failures on Fedora-x86_64-m64, " sergiodj+buildbot
2019-06-01 19:48 ` *** COMPILATION FAILED *** Failures on Debian-s390x-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-06-01 20:28 ` *** COMPILATION FAILED *** Failures on Debian-s390x-native-gdbserver-m64, " sergiodj+buildbot
2019-06-01 22:24 ` *** COMPILATION FAILED *** Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot
  -- strict thread matches above, loose matches on Subject: below --
2020-02-24  3:04 [binutils-gdb] Remove the TUI annotation hack gdb-buildbot
2020-02-24  5:01 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2020-02-24  2:28 [binutils-gdb] Remove tui_set_win_with_focus gdb-buildbot
2020-02-24  3:36 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2020-02-24  2:28 [binutils-gdb] Change how TUI windows are instantiated gdb-buildbot
2020-02-24  3:35 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-12-13  1:00 [binutils-gdb] Move free_all_objfiles to program_space gdb-buildbot
2019-12-13  1:19 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-12-13  0:56 [binutils-gdb] Store objfiles on a std::list gdb-buildbot
2019-12-13  1:17 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-12-12 12:19 [binutils-gdb] Fix unused function error gdb-buildbot
2019-12-12 12:24 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-12-10 19:28 [binutils-gdb] Replace the remaining uses of strerror with safe_strerror gdb-buildbot
2019-12-10 19:31 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-09-13  1:14 [binutils-gdb] gdb/testsuite: Make use of exec_has_index_section function gdb-buildbot
2019-09-13  1:33 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-09-13  1:12 [binutils-gdb] gdb: Have 'maint info sections' print all sections again gdb-buildbot
2019-09-13  1:26 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-07-18  1:24 [binutils-gdb] Introduce reset_locator function in tui-layout.c gdb-buildbot
2019-07-18  2:07 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-07-18  1:11 [binutils-gdb] Always create an execution info window for a source window gdb-buildbot
2019-07-18  1:46 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-06-25  8:03 [binutils-gdb] elf: Remove the property after reporting its removal gdb-buildbot
2019-06-25  8:19 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** gdb-buildbot
2019-05-30 16:46 [binutils-gdb] Two comment fixes in gdbtypes.h sergiodj+buildbot
2019-05-30 20:26 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-30 14:19 [binutils-gdb] Initialize variable word in complete sergiodj+buildbot
2019-05-30 14:32 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-30 11:54 [binutils-gdb] Revert "Sync top level files with versions from gcc." sergiodj+buildbot
2019-05-30 12:05 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 21:49 [binutils-gdb] Don't crash is dwarf_decode_macro_bytes's 'body' is NULL, even when '!is_define' sergiodj+buildbot
2019-05-29 22:15 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 16:38 [binutils-gdb] Make some DWARF complaints clearer sergiodj+buildbot
2019-05-29 17:00 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 16:22 [binutils-gdb] Fix crash in cp_print_value_fields sergiodj+buildbot
2019-05-29 16:31 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 16:06 [binutils-gdb] Add new GCC 9 warnings to warnings.m4 sergiodj+buildbot
2019-05-29 16:08 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 15:38 [binutils-gdb] Add "set print finish" sergiodj+buildbot
2019-05-29 15:44 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 13:07 [binutils-gdb] Update release tools with libctf support sergiodj+buildbot
2019-05-29 13:25 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 12:50 [binutils-gdb] Sync top level files with versions from gcc sergiodj+buildbot
2019-05-29 13:24 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 11:42 [binutils-gdb] Do not build libctf for targets that do not use the ELF file format sergiodj+buildbot
2019-05-29 11:44 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29 10:40 [binutils-gdb] Fix libctf build on non-ELF targets sergiodj+buildbot
2019-05-29 10:52 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29  1:13 [binutils-gdb] MIPS/LD: Skip overflow check for %pcrel_hi relocations sergiodj+buildbot
2019-05-29  3:24 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29  1:10 [binutils-gdb] x86: Add CheckRegSize to AVX512_BF16 instructions with Disp8ShiftVL sergiodj+buildbot
2019-05-29  3:14 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29  1:04 [binutils-gdb] Remove find_old_style_renaming_symbol sergiodj+buildbot
2019-05-29  2:57 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29  0:56 [binutils-gdb] Add libctf to top-level MAINTAINERS; add myself as CTF maintainer sergiodj+buildbot
2019-05-29  2:57 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-29  0:50 [binutils-gdb] libctf: build system sergiodj+buildbot
2019-05-29  2:31 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-05-08 17:01 [binutils-gdb] Fix style bug when paging sergiodj+buildbot
2019-05-08 17:31 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2019-01-07 13:26 [binutils-gdb] Sync libiberty sources with master version in gcc repository. Updated stabs demangling and cxxfilt tests to match sergiodj+buildbot
2019-01-07 13:34 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-12-28 23:52 [binutils-gdb] Fix a crash in jit.c sergiodj+buildbot
2018-12-29  0:24 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-12-28 23:46 [binutils-gdb] Document the "set style" commands sergiodj+buildbot
2018-12-29  0:13 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-12-28 23:31 [binutils-gdb] Highlight source code using GNU Source Highlight sergiodj+buildbot
2018-12-28 23:49 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-11-25 23:41 [binutils-gdb] Implement timestamp'ed output on "make check" sergiodj+buildbot
2018-11-25 23:45 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-11-25 23:04 [binutils-gdb] Remove obsolete comments from field_fmt sergiodj+buildbot
2018-11-25 23:12 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-11-24 12:23 [binutils-gdb] Re-fix leak in source.c (open_source_file) sergiodj+buildbot
2018-11-24 12:43 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-11-23 14:34 [binutils-gdb] gdbserver: AArch64: Remove cannot_fetch/store_register sergiodj+buildbot
2018-11-23 14:59 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-11-23 14:22 [binutils-gdb] Remove declarations of is_running/is_stopped/is_exited sergiodj+buildbot
2018-11-23 14:22 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-11-22 16:58 [binutils-gdb] Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc sergiodj+buildbot
2018-11-22 17:23 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-11-20 16:57 [binutils-gdb] Avoid "Invalid parameter passed to C runtime function" warning sergiodj+buildbot
2018-11-20 17:04 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-29  8:20 [binutils-gdb] GDB: Only build for "unix:" connections if AF_LOCAL is supported sergiodj+buildbot
2018-10-29 10:11 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-28 11:12 [binutils-gdb] gdb/riscv: Add back missing braces in riscv-linux-nat.c sergiodj+buildbot
2018-10-28 12:11 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-27 20:36 [binutils-gdb] OBVIOUS Use report_unrecognized_option_error in 'demangle' and 'info macro' commands sergiodj+buildbot
2018-10-27 21:32 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-27 18:36 [binutils-gdb] Cache a copy of the user's shell on macOS sergiodj+buildbot
2018-10-27 19:08 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-27 18:30 [binutils-gdb] Do not reopen temporary files sergiodj+buildbot
2018-10-27 19:03 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-27 18:24 [binutils-gdb] Use mkostemp, not mkstemp sergiodj+buildbot
2018-10-27 18:44 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-27 18:18 [binutils-gdb] Move mkdir_recursive to common/filestuff.c sergiodj+buildbot
2018-10-27 18:29 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-27 18:16 [binutils-gdb] Move make_temp_filename to common/pathstuff.c sergiodj+buildbot
2018-10-27 18:19 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-27 18:10 [binutils-gdb] Unify shell-finding logic sergiodj+buildbot
2018-10-27 18:15 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-08 22:07 [binutils-gdb] Add native target for FreeBSD/riscv sergiodj+buildbot
2018-10-08 22:18 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-08 22:02 [binutils-gdb] Add FreeBSD/riscv architecture sergiodj+buildbot
2018-10-08 22:09 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-08 21:57 [binutils-gdb] Add a helper function to trad_frame to support register cache maps sergiodj+buildbot
2018-10-08 22:01 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-10-08 21:42 [binutils-gdb] Finding data member in virtual base class sergiodj+buildbot
2018-10-08 21:46 ` *** COMPILATION FAILED *** Failures on Solaris11-amd64-m64, branch master *** BREAKAGE *** sergiodj+buildbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).