summaryrefslogtreecommitdiff
path: root/backends/libebl_CPU.h
diff options
context:
space:
mode:
Diffstat (limited to 'backends/libebl_CPU.h')
-rw-r--r--backends/libebl_CPU.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/backends/libebl_CPU.h b/backends/libebl_CPU.h
index 2abad76f..3b2cc3e4 100644
--- a/backends/libebl_CPU.h
+++ b/backends/libebl_CPU.h
@@ -1,5 +1,6 @@
/* Common interface for libebl modules.
Copyright (C) 2000, 2001, 2002, 2003, 2005, 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2023 Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -53,7 +54,9 @@ extern bool (*generic_debugscn_p) (const char *) attribute_hidden;
dwarf_tag (_die); })
/* Get a type die corresponding to DIE. Peel CV qualifiers off
- it. */
+ it. Returns zero if the DIE doesn't have a type, or the type
+ is DW_TAG_unspecified_type. Returns -1 on error. Otherwise
+ returns the result tag DW_AT value. */
static inline int
dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result)
{
@@ -69,7 +72,14 @@ dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result)
if (dwarf_peel_type (result, result) != 0)
return -1;
- return DWARF_TAG_OR_RETURN (result);
+ if (result == NULL)
+ return -1;
+
+ int tag = dwarf_tag (result);
+ if (tag == DW_TAG_unspecified_type)
+ return 0; /* Treat an unspecified type as if there was no type. */
+
+ return tag;
}
static inline bool