aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/die.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-26 21:13:20 -0700
committerTom Tromey <tom@tromey.com>2023-02-12 13:03:58 -0700
commitfdc82b33c455b049d4739ef0959f458263197a33 (patch)
tree8a3d71e0afeeb7d88cb3a858eb4f925d07224e84 /gdb/dwarf2/die.h
parent8282ad74c302a8e0db7a588e500ae117a1df68c5 (diff)
downloadgdb-fdc82b33c455b049d4739ef0959f458263197a33.zip
gdb-fdc82b33c455b049d4739ef0959f458263197a33.tar.gz
gdb-fdc82b33c455b049d4739ef0959f458263197a33.tar.bz2
Move some code from dwarf2/read.c to die.c
This patch introduces a new file, dwarf2/die.c, and moves some DIE-related code out of dwarf2/read.c and into this new file. This is just a small part of the long-term project to split up read.c. (According to 'wc', dwarf2/read.c is the largest file in gdb by around 8000 LOC.) Regression tested on x86-64 Fedora 36.
Diffstat (limited to 'gdb/dwarf2/die.h')
-rw-r--r--gdb/dwarf2/die.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/dwarf2/die.h b/gdb/dwarf2/die.h
index ae46514..cdee469 100644
--- a/gdb/dwarf2/die.h
+++ b/gdb/dwarf2/die.h
@@ -21,10 +21,31 @@
#define GDB_DWARF2_DIE_H
#include "complaints.h"
+#include "dwarf2/attribute.h"
/* This data structure holds a complete die structure. */
struct die_info
{
+ /* Allocate a new die_info on OBSTACK. NUM_ATTRS is the number of
+ attributes that are needed. */
+ static die_info *allocate (struct obstack *obstack, int num_attrs);
+
+ /* Trivial hash function for die_info: the hash value of a DIE is
+ its offset in .debug_info for this objfile. */
+ static hashval_t hash (const void *item);
+
+ /* Trivial comparison function for die_info structures: two DIEs
+ are equal if they have the same offset. */
+ static int eq (const void *item_lhs, const void *item_rhs);
+
+ /* Dump this DIE and any children to MAX_LEVEL. They are written to
+ gdb_stdlog. Note this is called from the pdie user command in
+ gdb-gdb.gdb. */
+ void dump (int max_level);
+
+ /* Shallowly dump this DIE to gdb_stderr. */
+ void error_dump ();
+
/* Return the named attribute or NULL if not there, but do not
follow DW_AT_specification, etc. */
struct attribute *attr (dwarf_attribute name)