2 /******************************************************************************
4 * Name: debugger.h - ACPI/AML debugger
6 *****************************************************************************/
9 * Copyright (C) 2000 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
26 #ifndef __DEBUGGER_H__
27 #define __DEBUGGER_H__
30 #define DB_MAX_ARGS 8 /* Must be max method args + 1 */
32 #define DB_COMMAND_PROMPT '-'
33 #define DB_EXECUTE_PROMPT '%'
39 extern u32 acpi_aml_length
;
44 extern u8 opt_parse_jit
;
45 extern u8 opt_verbose
;
48 extern char *args
[DB_MAX_ARGS
];
49 extern char line_buf
[80];
50 extern char scope_buf
[40];
51 extern char debug_filename
[40];
52 extern u8 output_to_file
;
54 extern char *filename
;
55 extern char *INDENT_STRING
;
56 extern u32 acpi_gbl_method_breakpoint
;
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
;
69 extern u32 num_named_objects
;
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 char *name
; /* Command Name */
94 char min_args
; /* Minimum arguments required */
99 typedef struct argument_info
101 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
,
136 * dbcmds - debug commands and output routines
141 acpi_db_display_table_info (
145 acpi_db_unload_acpi_table (
150 acpi_db_set_method_breakpoint (
152 ACPI_WALK_STATE
*walk_state
,
153 ACPI_GENERIC_OP
*op
);
156 acpi_db_set_method_call_breakpoint (
157 ACPI_GENERIC_OP
*op
);
160 acpi_db_disassemble_aml (
162 ACPI_GENERIC_OP
*op
);
165 acpi_db_dump_namespace (
170 acpi_db_dump_namespace_by_owner (
175 acpi_db_send_notify (
180 acpi_db_set_method_data (
186 acpi_db_display_objects (
188 char *display_count_arg
);
191 acpi_db_find_name_in_namespace (
199 acpi_db_find_references (
204 * dbdisasm - AML disassembler
209 ACPI_GENERIC_OP
*origin
,
213 acpi_db_display_namestring (
217 acpi_db_display_path (
218 ACPI_GENERIC_OP
*op
);
221 acpi_db_display_opcode (
222 ACPI_GENERIC_OP
*op
);
226 * dbdisply - debug display commands
231 acpi_db_display_method_info (
232 ACPI_GENERIC_OP
*op
);
235 acpi_db_decode_and_display_object (
240 acpi_db_display_result_object (
241 ACPI_OBJECT_INTERNAL
*ret_desc
);
244 acpi_db_display_all_methods (
245 char *display_count_arg
);
248 acpi_db_display_internal_object (
249 ACPI_OBJECT_INTERNAL
*obj_desc
);
252 acpi_db_display_arguments (
256 acpi_db_display_locals (
260 acpi_db_display_results (
264 acpi_db_display_calling_tree (
268 acpi_db_display_argument_object (
269 ACPI_OBJECT_INTERNAL
*obj_desc
);
273 * dbexec - debugger control method execution
283 acpi_db_create_execution_threads (
284 char *num_threads_arg
,
286 char *method_name_arg
);
290 * dbfileio - Debugger file I/O commands
294 acpi_db_match_argument (
296 ARGUMENT_INFO
*arguments
);
300 acpi_db_close_debug_file (
304 acpi_db_open_debug_file (
308 acpi_db_load_acpi_table (
313 * dbhistry - debugger HISTORY command
317 acpi_db_add_to_history (
321 acpi_db_display_history (void);
324 acpi_db_get_from_history (
325 char *command_num_arg
);
329 * dbinput - user front-end to the AML debugger
333 acpi_db_command_dispatch (
335 ACPI_WALK_STATE
*walk_state
,
336 ACPI_GENERIC_OP
*op
);
339 acpi_db_execute_thread (
343 acpi_db_user_commands (
345 ACPI_GENERIC_OP
*op
);
349 * dbstats - Generation and display of ACPI table statistics
353 acpi_db_generate_statistics (
354 ACPI_GENERIC_OP
*root
,
359 acpi_db_display_statistics (
364 * dbutils - AML debugger utilities
368 acpi_db_set_output_destination (
372 acpi_db_dump_buffer (
376 acpi_db_dump_object (
377 ACPI_OBJECT
*obj_desc
,
381 acpi_db_prep_namestring (
386 acpi_db_second_pass_parse (
387 ACPI_GENERIC_OP
*root
);
390 acpi_db_local_ns_lookup (
394 #endif /* __DEBUGGER_H__ */