summaryrefslogtreecommitdiff
path: root/addr2line.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-21 16:37:24 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-21 16:37:24 +0000
commit6018bc5e73de93250afad2cda4043a780dd4e6e9 (patch)
treea4665e3e66353afeb94ca1452dc30f6451e31dd0 /addr2line.c
parente6202c41b5685ef0a6551e008c567230ec85d2bf (diff)
Use inline function with stable code instead of macro
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'addr2line.c')
-rw-r--r--addr2line.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/addr2line.c b/addr2line.c
index c28bf8b459..3ab5c36f9b 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -159,9 +159,25 @@ typedef struct obj_info {
struct dwarf_section debug_str;
struct obj_info *next;
} obj_info_t;
-#define obj_dwarf_section_at(obj,n) (&obj->debug_abbrev + n)
+
#define DWARF_SECTION_COUNT 5
+static struct dwarf_section *
+obj_dwarf_section_at(obj_info_t *obj, int n)
+{
+ struct dwarf_section *ary[] = {
+ &obj->debug_abbrev,
+ &obj->debug_info,
+ &obj->debug_line,
+ &obj->debug_ranges,
+ &obj->debug_str
+ };
+ if (n < 0 || DWARF_SECTION_COUNT <= n) {
+ abort();
+ }
+ return ary[n];
+}
+
struct debug_section_definition {
const char *name;
struct dwarf_section *dwarf;