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#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acdispat.h"
47#include "acnamesp.h"
48#ifdef ACPI_DISASSEMBLER
49#include "acdisasm.h"
50#endif
51#include "acinterp.h"
52
53#define _COMPONENT ACPI_DISPATCHER
54ACPI_MODULE_NAME("dsdebug")
55
56#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
57
58static void
59acpi_ds_print_node_pathname(struct acpi_namespace_node *node,
60 const char *message);
61
62
63
64
65
66
67
68
69
70
71
72
73
74static void
75acpi_ds_print_node_pathname(struct acpi_namespace_node *node,
76 const char *message)
77{
78 struct acpi_buffer buffer;
79 acpi_status status;
80
81 ACPI_FUNCTION_TRACE(ds_print_node_pathname);
82
83 if (!node) {
84 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "[NULL NAME]"));
85 return_VOID;
86 }
87
88
89
90 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
91
92 status = acpi_ns_handle_to_pathname(node, &buffer, TRUE);
93 if (ACPI_SUCCESS(status)) {
94 if (message) {
95 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "%s ",
96 message));
97 }
98
99 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "[%s] (Node %p)",
100 (char *)buffer.pointer, node));
101 ACPI_FREE(buffer.pointer);
102 }
103
104 return_VOID;
105}
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122void
123acpi_ds_dump_method_stack(acpi_status status,
124 struct acpi_walk_state *walk_state,
125 union acpi_parse_object *op)
126{
127 union acpi_parse_object *next;
128 struct acpi_thread_state *thread;
129 struct acpi_walk_state *next_walk_state;
130 struct acpi_namespace_node *previous_method = NULL;
131 union acpi_operand_object *method_desc;
132
133 ACPI_FUNCTION_TRACE(ds_dump_method_stack);
134
135
136
137 if ((status & AE_CODE_MASK) == AE_CODE_CONTROL) {
138 return_VOID;
139 }
140
141
142
143 if (walk_state->deferred_node) {
144 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
145 "Executing subtree for Buffer/Package/Region\n"));
146 return_VOID;
147 }
148
149
150
151
152
153
154 thread = walk_state->thread;
155 if (!thread) {
156 return_VOID;
157 }
158
159
160
161 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
162 "\n**** Exception %s during execution of method ",
163 acpi_format_exception(status)));
164
165 acpi_ds_print_node_pathname(walk_state->method_node, NULL);
166
167
168
169 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH,
170 "\n\nMethod Execution Stack:\n"));
171 next_walk_state = thread->walk_state_list;
172
173
174
175 while (next_walk_state) {
176 method_desc = next_walk_state->method_desc;
177 if (method_desc) {
178 acpi_ex_stop_trace_method((struct acpi_namespace_node *)
179 method_desc->method.node,
180 method_desc, walk_state);
181 }
182
183 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
184 " Method [%4.4s] executing: ",
185 acpi_ut_get_node_name(next_walk_state->
186 method_node)));
187
188
189
190 if (next_walk_state == walk_state) {
191 if (op) {
192
193
194
195 next = op->common.next;
196 op->common.next = NULL;
197
198#ifdef ACPI_DISASSEMBLER
199 acpi_dm_disassemble(next_walk_state, op,
200 ACPI_UINT32_MAX);
201#endif
202 op->common.next = next;
203 }
204 } else {
205
206
207
208
209
210 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH,
211 "Call to method "));
212 acpi_ds_print_node_pathname(previous_method, NULL);
213 }
214
215 previous_method = next_walk_state->method_node;
216 next_walk_state = next_walk_state->next;
217 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "\n"));
218 }
219
220 return_VOID;
221}
222
223#else
224void
225acpi_ds_dump_method_stack(acpi_status status,
226 struct acpi_walk_state *walk_state,
227 union acpi_parse_object *op)
228{
229 return;
230}
231
232#endif
233