summaryrefslogtreecommitdiff
path: root/devel/apitrace/files/patch-thirdparty_libbacktrace_dwarf.c
blob: 6f58dcfe953a7bcbd6d7a91b60b31234f65a74a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
--- thirdparty/libbacktrace/dwarf.c.orig	2017-10-13 17:18:18 UTC
+++ thirdparty/libbacktrace/dwarf.c
@@ -768,21 +768,27 @@ read_attribute (enum dwarf_form form, st
 			       version, addrsize, dwarf_str, dwarf_str_size,
 			       val);
       }
+#if defined(DW_FORM_sec_offset) // not defined on 10
     case DW_FORM_sec_offset:
       val->encoding = ATTR_VAL_REF_SECTION;
       val->u.uint = read_offset (buf, is_dwarf64);
       return 1;
+#endif
+#if defined(DW_FORM_exprloc) // not defined on 10
     case DW_FORM_exprloc:
       val->encoding = ATTR_VAL_EXPR;
       return advance (buf, read_uleb128 (buf));
+#endif
     case DW_FORM_flag_present:
       val->encoding = ATTR_VAL_UINT;
       val->u.uint = 1;
       return 1;
+#if defined(DW_FORM_ref_sig8) // not defined on 10
     case DW_FORM_ref_sig8:
       val->encoding = ATTR_VAL_REF_TYPE;
       val->u.uint = read_uint64 (buf);
       return 1;
+#endif
     case DW_FORM_GNU_addr_index:
       val->encoding = ATTR_VAL_REF_SECTION;
       val->u.uint = read_uleb128 (buf);
@@ -1314,7 +1320,7 @@ find_address_ranges (struct backtrace_st
 		  highpc_is_relative = 1;
 		}
 	      break;
-
+#if defined(DW_AT_ranges) // not defined on 10
 	    case DW_AT_ranges:
 	      if (val.encoding == ATTR_VAL_UINT
 		  || val.encoding == ATTR_VAL_REF_SECTION)
@@ -1323,7 +1329,7 @@ find_address_ranges (struct backtrace_st
 		  have_ranges = 1;
 		}
 	      break;
-
+#endif
 	    case DW_AT_stmt_list:
 	      if (abbrev->tag == DW_TAG_compile_unit
 		  && (val.encoding == ATTR_VAL_UINT
@@ -1851,10 +1857,6 @@ read_line_program (struct backtrace_stat
 		  }
 	      }
 	      break;
-	    case DW_LNE_set_discriminator:
-	      /* We don't care about discriminators.  */
-	      read_uleb128 (line_buf);
-	      break;
 	    default:
 	      if (!advance (line_buf, len - 1))
 		return 0;
@@ -2108,16 +2110,24 @@ read_referenced_name (struct dwarf_data 
 	  if (val.encoding == ATTR_VAL_STRING)
 	    ret = val.u.string;
 	  break;
-
+#if defined(DW_AT_linkage_name)
 	case DW_AT_linkage_name:
+#endif
+#if defined(DW_AT_MIPS_linkage_name)
 	case DW_AT_MIPS_linkage_name:
+#endif
+#if defined(DW_AT_linkage_name) || defined(DW_AT_MIPS_linkage_name)
 	  if (val.encoding == ATTR_VAL_STRING)
 	    return val.u.string;
 	  break;
-
+#endif
 	case DW_AT_specification:
 	  if (abbrev->attrs[i].form == DW_FORM_ref_addr
+#if defined(DW_FORM_ref_sig8) // not defined on 10
 	      || abbrev->attrs[i].form == DW_FORM_ref_sig8)
+#else
+	      || 0) // not defined
+#endif
 	    {
 	      /* This refers to a specification defined in some other
 		 compilation unit.  We can handle this case if we
@@ -2325,6 +2335,7 @@ read_function_entry (struct backtrace_st
 	    {
 	      switch (abbrev->attrs[i].name)
 		{
+#if defined(DW_AT_call_file)
 		case DW_AT_call_file:
 		  if (val.encoding == ATTR_VAL_UINT)
 		    {
@@ -2344,16 +2355,21 @@ read_function_entry (struct backtrace_st
 			}
 		    }
 		  break;
-
+#endif
+#if defined(DW_AT_call_line)
 		case DW_AT_call_line:
 		  if (val.encoding == ATTR_VAL_UINT)
 		    function->caller_lineno = val.u.uint;
 		  break;
-
+#endif
 		case DW_AT_abstract_origin:
 		case DW_AT_specification:
 		  if (abbrev->attrs[i].form == DW_FORM_ref_addr
+#if defined(DW_FORM_ref_sig8) // not defined on 10
 		      || abbrev->attrs[i].form == DW_FORM_ref_sig8)
+#else
+		      || 0) // not defined
+#endif
 		    {
 		      /* This refers to an abstract origin defined in
 			 some other compilation unit.  We can handle
@@ -2383,13 +2399,17 @@ read_function_entry (struct backtrace_st
 			function->name = val.u.string;
 		    }
 		  break;
-
+#if defined(DW_AT_linkage_name)
 		case DW_AT_linkage_name:
+#endif
+#if defined(DW_AT_MIPS_linkage_name)
 		case DW_AT_MIPS_linkage_name:
+#endif
+#if defined(DW_AT_linkage_name) || defined(DW_AT_MIPS_linkage_name)
 		  if (val.encoding == ATTR_VAL_STRING)
 		    function->name = val.u.string;
 		  break;
-
+#endif
 		case DW_AT_low_pc:
 		  if (val.encoding == ATTR_VAL_ADDRESS)
 		    {
@@ -2411,7 +2431,7 @@ read_function_entry (struct backtrace_st
 		      highpc_is_relative = 1;
 		    }
 		  break;
-
+#if defined(DW_AT_ranges) // not defined on 10
 		case DW_AT_ranges:
 		  if (val.encoding == ATTR_VAL_UINT
 		      || val.encoding == ATTR_VAL_REF_SECTION)
@@ -2420,7 +2440,7 @@ read_function_entry (struct backtrace_st
 		      have_ranges = 1;
 		    }
 		  break;
-
+#endif
 		default:
 		  break;
 		}