public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Move DWARF-constant stringifying code to new file
Date: Fri, 10 Apr 2020 20:00:23 -0400	[thread overview]
Message-ID: <2b2558bfacba3813863da6728c021eb89fa34677@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 2b2558bfacba3813863da6728c021eb89fa34677 ***

commit 2b2558bfacba3813863da6728c021eb89fa34677
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Thu Mar 26 09:28:08 2020 -0600
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Thu Mar 26 09:28:26 2020 -0600

    Move DWARF-constant stringifying code to new file
    
    This moves the DWARF debugging functions that stringify various
    constants to a new file, dwarf2/stringify.c.
    
    gdb/ChangeLog
    2020-03-26  Tom Tromey  <tom@tromey.com>
    
            * dwarf2/read.c (dwarf_unit_type_name, dwarf_tag_name)
            (dwarf_attr_name, dwarf_form_name, dwarf_bool_name)
            (dwarf_type_encoding_name): Move to stringify.c.
            * Makefile.in (COMMON_SFILES): Add dwarf2/stringify.c.
            * dwarf2/stringify.c: New file.
            * dwarf2/stringify.h: New file.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 670f7f6c25..c8f40a7dfb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2020-03-26  Tom Tromey  <tom@tromey.com>
+
+	* dwarf2/read.c (dwarf_unit_type_name, dwarf_tag_name)
+	(dwarf_attr_name, dwarf_form_name, dwarf_bool_name)
+	(dwarf_type_encoding_name): Move to stringify.c.
+	* Makefile.in (COMMON_SFILES): Add dwarf2/stringify.c.
+	* dwarf2/stringify.c: New file.
+	* dwarf2/stringify.h: New file.
+
 2020-03-26  Tom Tromey  <tom@tromey.com>
 
 	* dwarf2/die.h (struct die_info) <addr_base, ranges_base>:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index f66affd3e5..bc3ef695bb 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1016,6 +1016,7 @@ COMMON_SFILES = \
 	dwarf2/macro.c \
 	dwarf2/read.c \
 	dwarf2/section.c \
+	dwarf2/stringify.c \
 	eval.c \
 	event-loop.c \
 	event-top.c \
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 64e92ff92f..b363088a6a 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -40,6 +40,7 @@
 #include "dwarf2/dwz.h"
 #include "dwarf2/macro.h"
 #include "dwarf2/die.h"
+#include "dwarf2/stringify.h"
 #include "bfd.h"
 #include "elf-bfd.h"
 #include "symtab.h"
@@ -1406,16 +1407,6 @@ static const char *dwarf2_physname (const char *name, struct die_info *die,
 static struct die_info *dwarf2_extension (struct die_info *die,
 					  struct dwarf2_cu **);
 
-static const char *dwarf_tag_name (unsigned int);
-
-static const char *dwarf_attr_name (unsigned int);
-
-static const char *dwarf_form_name (unsigned int);
-
-static const char *dwarf_bool_name (unsigned int);
-
-static const char *dwarf_type_encoding_name (unsigned int);
-
 static void dump_die_shallow (struct ui_file *, int indent, struct die_info *);
 
 static void dump_die_for_error (struct die_info *);
@@ -21334,89 +21325,6 @@ dwarf2_extension (struct die_info *die, struct dwarf2_cu **ext_cu)
   return follow_die_ref (die, attr, ext_cu);
 }
 
-/* A convenience function that returns an "unknown" DWARF name,
-   including the value of V.  STR is the name of the entity being
-   printed, e.g., "TAG".  */
-
-static const char *
-dwarf_unknown (const char *str, unsigned v)
-{
-  char *cell = get_print_cell ();
-  xsnprintf (cell, PRINT_CELL_SIZE, "DW_%s_<unknown: %u>", str, v);
-  return cell;
-}
-
-/* Convert a DIE tag into its string name.  */
-
-static const char *
-dwarf_tag_name (unsigned tag)
-{
-  const char *name = get_DW_TAG_name (tag);
-
-  if (name == NULL)
-    return dwarf_unknown ("TAG", tag);
-
-  return name;
-}
-
-/* Convert a DWARF attribute code into its string name.  */
-
-static const char *
-dwarf_attr_name (unsigned attr)
-{
-  const char *name;
-
-#ifdef MIPS /* collides with DW_AT_HP_block_index */
-  if (attr == DW_AT_MIPS_fde)
-    return "DW_AT_MIPS_fde";
-#else
-  if (attr == DW_AT_HP_block_index)
-    return "DW_AT_HP_block_index";
-#endif
-
-  name = get_DW_AT_name (attr);
-
-  if (name == NULL)
-    return dwarf_unknown ("AT", attr);
-
-  return name;
-}
-
-/* Convert a DWARF value form code into its string name.  */
-
-static const char *
-dwarf_form_name (unsigned form)
-{
-  const char *name = get_DW_FORM_name (form);
-
-  if (name == NULL)
-    return dwarf_unknown ("FORM", form);
-
-  return name;
-}
-
-static const char *
-dwarf_bool_name (unsigned mybool)
-{
-  if (mybool)
-    return "TRUE";
-  else
-    return "FALSE";
-}
-
-/* Convert a DWARF type code into its string name.  */
-
-static const char *
-dwarf_type_encoding_name (unsigned enc)
-{
-  const char *name = get_DW_ATE_name (enc);
-
-  if (name == NULL)
-    return dwarf_unknown ("ATE", enc);
-
-  return name;
-}
-
 static void
 dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 {
diff --git a/gdb/dwarf2/stringify.c b/gdb/dwarf2/stringify.c
new file mode 100644
index 0000000000..0cdefe8108
--- /dev/null
+++ b/gdb/dwarf2/stringify.c
@@ -0,0 +1,114 @@
+/* DWARF stringify code
+
+   Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
+   Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
+   Inc.  with support from Florida State University (under contract
+   with the Ada Joint Program Office), and Silicon Graphics, Inc.
+   Initial contribution by Brent Benson, Harris Computer Systems, Inc.,
+   based on Fred Fish's (Cygnus Support) implementation of DWARF 1
+   support.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "defs.h"
+#include "dwarf2.h"
+#include "dwarf2/stringify.h"
+
+/* A convenience function that returns an "unknown" DWARF name,
+   including the value of V.  STR is the name of the entity being
+   printed, e.g., "TAG".  */
+
+static const char *
+dwarf_unknown (const char *str, unsigned v)
+{
+  char *cell = get_print_cell ();
+  xsnprintf (cell, PRINT_CELL_SIZE, "DW_%s_<unknown: %u>", str, v);
+  return cell;
+}
+
+/* See stringify.h.  */
+
+const char *
+dwarf_tag_name (unsigned tag)
+{
+  const char *name = get_DW_TAG_name (tag);
+
+  if (name == NULL)
+    return dwarf_unknown ("TAG", tag);
+
+  return name;
+}
+
+/* See stringify.h.  */
+
+const char *
+dwarf_attr_name (unsigned attr)
+{
+  const char *name;
+
+#ifdef MIPS /* collides with DW_AT_HP_block_index */
+  if (attr == DW_AT_MIPS_fde)
+    return "DW_AT_MIPS_fde";
+#else
+  if (attr == DW_AT_HP_block_index)
+    return "DW_AT_HP_block_index";
+#endif
+
+  name = get_DW_AT_name (attr);
+
+  if (name == NULL)
+    return dwarf_unknown ("AT", attr);
+
+  return name;
+}
+
+/* See stringify.h.  */
+
+const char *
+dwarf_form_name (unsigned form)
+{
+  const char *name = get_DW_FORM_name (form);
+
+  if (name == NULL)
+    return dwarf_unknown ("FORM", form);
+
+  return name;
+}
+
+/* See stringify.h.  */
+
+const char *
+dwarf_bool_name (unsigned mybool)
+{
+  if (mybool)
+    return "TRUE";
+  else
+    return "FALSE";
+}
+
+/* See stringify.h.  */
+
+const char *
+dwarf_type_encoding_name (unsigned enc)
+{
+  const char *name = get_DW_ATE_name (enc);
+
+  if (name == NULL)
+    return dwarf_unknown ("ATE", enc);
+
+  return name;
+}
diff --git a/gdb/dwarf2/stringify.h b/gdb/dwarf2/stringify.h
new file mode 100644
index 0000000000..d3b3d2c191
--- /dev/null
+++ b/gdb/dwarf2/stringify.h
@@ -0,0 +1,38 @@
+/* DWARF stringify code
+
+   Copyright (C) 2003-2020 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef GDB_DWARF2_STRINGIFY_H
+#define GDB_DWARF2_STRINGIFY_H
+
+/* Convert a DIE tag into its string name.  */
+extern const char *dwarf_tag_name (unsigned tag);
+
+/* Convert a DWARF attribute code into its string name.  */
+extern const char *dwarf_attr_name (unsigned attr);
+
+/* Convert a DWARF value form code into its string name.  */
+extern const char *dwarf_form_name (unsigned form);
+
+/* Convert a boolean to a string form.  */
+extern const char *dwarf_bool_name (unsigned mybool);
+
+/* Convert a DWARF type code into its string name.  */
+extern const char *dwarf_type_encoding_name (unsigned enc);
+
+#endif /* GDB_DWARF2_STRINGIFY_H */


             reply	other threads:[~2020-04-11  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-11  0:00 gdb-buildbot [this message]
2020-04-11  0:00 ` Failures on Fedora-i686, branch master gdb-buildbot
2020-04-11  0:20 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-04-11  0:48 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-04-11  1:07 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-04-11  1:46 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-04-11  2:11 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-04-14  8:27 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-04-16 14:18 ` Failures on Ubuntu-Aarch64-m64, " gdb-buildbot
2020-04-16 14:34 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2020-04-16 16:23 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2b2558bfacba3813863da6728c021eb89fa34677@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).