1 /******************************************************************************
3 * Name: acdebug.h - ACPI/AML debugger
6 *****************************************************************************/
9 * Copyright (C) 2000, 2001 R. Byron Moore
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #define DB_MAX_ARGS 8 /* Must be max method args + 1 */
32 #define DB_COMMAND_PROMPT '-'
33 #define DB_EXECUTE_PROMPT '%'
37 extern NATIVE_CHAR
*optarg
;
39 extern u32 acpi_aml_length
;
44 extern u8 opt_parse_jit
;
45 extern u8 opt_verbose
;
46 extern u8 opt_ini_methods
;
49 extern NATIVE_CHAR
*args
[DB_MAX_ARGS
];
50 extern NATIVE_CHAR line_buf
[80];
51 extern NATIVE_CHAR scope_buf
[40];
52 extern NATIVE_CHAR debug_filename
[40];
53 extern u8 output_to_file
;
54 extern NATIVE_CHAR
*buffer
;
55 extern NATIVE_CHAR
*filename
;
56 extern NATIVE_CHAR
*INDENT_STRING
;
57 extern u8 acpi_gbl_db_output_flags
;
58 extern u32 acpi_gbl_db_debug_level
;
59 extern u32 acpi_gbl_db_console_debug_level
;
62 extern u32 num_methods
;
63 extern u32 num_regions
;
64 extern u32 num_packages
;
65 extern u32 num_aliases
;
66 extern u32 num_devices
;
67 extern u32 num_field_defs
;
68 extern u32 num_thermal_zones
;
70 extern u32 num_grammar_elements
;
71 extern u32 num_method_elements
;
72 extern u32 num_mutexes
;
73 extern u32 num_power_resources
;
74 extern u32 num_bank_fields
;
75 extern u32 num_index_fields
;
76 extern u32 num_events
;
78 extern u32 size_of_parse_tree
;
79 extern u32 size_of_method_trees
;
80 extern u32 size_of_nTes
;
81 extern u32 size_of_acpi_objects
;
84 #define BUFFER_SIZE 4196
86 #define DB_REDIRECTABLE_OUTPUT 0x01
87 #define DB_CONSOLE_OUTPUT 0x02
88 #define DB_DUPLICATE_OUTPUT 0x03
91 typedef struct command_info
93 NATIVE_CHAR
*name
; /* Command Name */
94 u8 min_args
; /* Minimum arguments required */
99 typedef struct argument_info
101 NATIVE_CHAR
*name
; /* Argument Name */
106 #define PARAM_LIST(pl) pl
108 #define DBTEST_OUTPUT_LEVEL(lvl) if (opt_verbose)
110 #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
111 acpi_os_printf PARAM_LIST(fp);}
113 #define EX_NO_SINGLE_STEP 1
114 #define EX_SINGLE_STEP 2
121 * dbapi - external debugger interfaces
129 acpi_db_single_step (
130 ACPI_WALK_STATE
*walk_state
,
131 ACPI_PARSE_OBJECT
*op
,
136 * dbcmds - debug commands and output routines
141 acpi_db_display_table_info (
142 NATIVE_CHAR
*table_arg
);
145 acpi_db_unload_acpi_table (
146 NATIVE_CHAR
*table_arg
,
147 NATIVE_CHAR
*instance_arg
);
150 acpi_db_set_method_breakpoint (
151 NATIVE_CHAR
*location
,
152 ACPI_WALK_STATE
*walk_state
,
153 ACPI_PARSE_OBJECT
*op
);
156 acpi_db_set_method_call_breakpoint (
157 ACPI_PARSE_OBJECT
*op
);
160 acpi_db_disassemble_aml (
161 NATIVE_CHAR
*statements
,
162 ACPI_PARSE_OBJECT
*op
);
165 acpi_db_dump_namespace (
166 NATIVE_CHAR
*start_arg
,
167 NATIVE_CHAR
*depth_arg
);
170 acpi_db_dump_namespace_by_owner (
171 NATIVE_CHAR
*owner_arg
,
172 NATIVE_CHAR
*depth_arg
);
175 acpi_db_send_notify (
180 acpi_db_set_method_data (
181 NATIVE_CHAR
*type_arg
,
182 NATIVE_CHAR
*index_arg
,
183 NATIVE_CHAR
*value_arg
);
186 acpi_db_display_objects (
187 NATIVE_CHAR
*obj_type_arg
,
188 NATIVE_CHAR
*display_count_arg
);
191 acpi_db_find_name_in_namespace (
192 NATIVE_CHAR
*name_arg
);
199 acpi_db_find_references (
200 NATIVE_CHAR
*object_arg
);
203 acpi_db_display_locks (void);
207 acpi_db_display_resources (
208 NATIVE_CHAR
*object_arg
);
212 * dbdisasm - AML disassembler
217 ACPI_WALK_STATE
*walk_state
,
218 ACPI_PARSE_OBJECT
*origin
,
222 acpi_db_display_namestring (
226 acpi_db_display_path (
227 ACPI_PARSE_OBJECT
*op
);
230 acpi_db_display_opcode (
231 ACPI_WALK_STATE
*walk_state
,
232 ACPI_PARSE_OBJECT
*op
);
235 acpi_db_decode_internal_object (
236 ACPI_OPERAND_OBJECT
*obj_desc
);
240 * dbdisply - debug display commands
245 acpi_db_display_method_info (
246 ACPI_PARSE_OBJECT
*op
);
249 acpi_db_decode_and_display_object (
251 NATIVE_CHAR
*output_type
);
254 acpi_db_display_result_object (
255 ACPI_OPERAND_OBJECT
*obj_desc
,
256 ACPI_WALK_STATE
*walk_state
);
259 acpi_db_display_all_methods (
260 NATIVE_CHAR
*display_count_arg
);
263 acpi_db_display_internal_object (
264 ACPI_OPERAND_OBJECT
*obj_desc
,
265 ACPI_WALK_STATE
*walk_state
);
268 acpi_db_display_arguments (
272 acpi_db_display_locals (
276 acpi_db_display_results (
280 acpi_db_display_calling_tree (
284 acpi_db_display_argument_object (
285 ACPI_OPERAND_OBJECT
*obj_desc
,
286 ACPI_WALK_STATE
*walk_state
);
290 * dbexec - debugger control method execution
300 acpi_db_create_execution_threads (
301 NATIVE_CHAR
*num_threads_arg
,
302 NATIVE_CHAR
*num_loops_arg
,
303 NATIVE_CHAR
*method_name_arg
);
307 * dbfileio - Debugger file I/O commands
311 acpi_db_match_argument (
312 NATIVE_CHAR
*user_argument
,
313 ARGUMENT_INFO
*arguments
);
317 acpi_db_close_debug_file (
321 acpi_db_open_debug_file (
325 acpi_db_load_acpi_table (
326 NATIVE_CHAR
*filename
);
330 * dbhistry - debugger HISTORY command
334 acpi_db_add_to_history (
335 NATIVE_CHAR
*command_line
);
338 acpi_db_display_history (void);
341 acpi_db_get_from_history (
342 NATIVE_CHAR
*command_num_arg
);
346 * dbinput - user front-end to the AML debugger
350 acpi_db_command_dispatch (
351 NATIVE_CHAR
*input_buffer
,
352 ACPI_WALK_STATE
*walk_state
,
353 ACPI_PARSE_OBJECT
*op
);
356 acpi_db_execute_thread (
360 acpi_db_user_commands (
362 ACPI_PARSE_OBJECT
*op
);
366 * dbstats - Generation and display of ACPI table statistics
370 acpi_db_generate_statistics (
371 ACPI_PARSE_OBJECT
*root
,
376 acpi_db_display_statistics (
377 NATIVE_CHAR
*type_arg
);
381 * dbutils - AML debugger utilities
385 acpi_db_set_output_destination (
389 acpi_db_dump_buffer (
393 acpi_db_dump_object (
394 ACPI_OBJECT
*obj_desc
,
398 acpi_db_prep_namestring (
403 acpi_db_second_pass_parse (
404 ACPI_PARSE_OBJECT
*root
);
406 ACPI_NAMESPACE_NODE
*
407 acpi_db_local_ns_lookup (
411 #endif /* __ACDEBUG_H__ */