Index: gdb/gdbarch.h |
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h |
index 46c5afa3300880de6e5c8841ee0da2fe3ba894bb..a239aa45966fcfc5aa34f50dc25ae9ddff210bcc 100644 |
--- a/gdb/gdbarch.h |
+++ b/gdb/gdbarch.h |
@@ -55,6 +55,7 @@ struct core_regset_section; |
struct syscall; |
struct agent_expr; |
struct axs_value; |
+struct stap_parse_info; |
/* The architecture associated with the connection to the target. |
@@ -68,6 +69,12 @@ struct axs_value; |
GDB, this global should be made target-specific. */ |
extern struct gdbarch *target_gdbarch; |
+/* Callback type for the 'iterate_over_objfiles_in_search_order' |
+ gdbarch method. */ |
+ |
+typedef int (iterate_over_objfiles_in_search_order_cb_ftype) |
+ (struct objfile *objfile, void *cb_data); |
+ |
/* The following are pre-initialized by GDBARCH. */ |
@@ -433,8 +440,8 @@ typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct gdbarch *gdbarch, s |
extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf); |
extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype *integer_to_address); |
-/* Return the return-value convention that will be used by FUNCTYPE |
- to return a value of type VALTYPE. FUNCTYPE may be NULL in which |
+/* Return the return-value convention that will be used by FUNCTION |
+ to return a value of type VALTYPE. FUNCTION may be NULL in which |
case the return convention is computed based only on VALTYPE. |
If READBUF is not NULL, extract the return value and save it in this buffer. |
@@ -446,10 +453,20 @@ extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_int |
extern int gdbarch_return_value_p (struct gdbarch *gdbarch); |
-typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct type *functype, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf); |
-extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct type *functype, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf); |
+typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf); |
+extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf); |
extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value); |
+/* Return true if the return value of function is stored in the first hidden |
+ parameter. In theory, this feature should be language-dependent, specified |
+ by language and its ABI, such as C++. Unfortunately, compiler may |
+ implement it to a target-dependent feature. So that we need such hook here |
+ to be aware of this in GDB. */ |
+ |
+typedef int (gdbarch_return_in_first_hidden_param_p_ftype) (struct gdbarch *gdbarch, struct type *type); |
+extern int gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, struct type *type); |
+extern void set_gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p); |
+ |
typedef CORE_ADDR (gdbarch_skip_prologue_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip); |
extern CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip); |
extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue); |
@@ -631,8 +648,8 @@ extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_sk |
/* Some systems also have trampoline code for returning from shared libs. */ |
-typedef int (gdbarch_in_solib_return_trampoline_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); |
-extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); |
+typedef int (gdbarch_in_solib_return_trampoline_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name); |
+extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name); |
extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline); |
/* A target might have problems with watchpoints as soon as the stack |
@@ -709,6 +726,22 @@ extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbar |
extern struct core_regset_section * gdbarch_core_regset_sections (struct gdbarch *gdbarch); |
extern void set_gdbarch_core_regset_sections (struct gdbarch *gdbarch, struct core_regset_section * core_regset_sections); |
+/* Create core file notes */ |
+ |
+extern int gdbarch_make_corefile_notes_p (struct gdbarch *gdbarch); |
+ |
+typedef char * (gdbarch_make_corefile_notes_ftype) (struct gdbarch *gdbarch, bfd *obfd, int *note_size); |
+extern char * gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size); |
+extern void set_gdbarch_make_corefile_notes (struct gdbarch *gdbarch, gdbarch_make_corefile_notes_ftype *make_corefile_notes); |
+ |
+/* Find core file memory regions */ |
+ |
+extern int gdbarch_find_memory_regions_p (struct gdbarch *gdbarch); |
+ |
+typedef int (gdbarch_find_memory_regions_ftype) (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data); |
+extern int gdbarch_find_memory_regions (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data); |
+extern void set_gdbarch_find_memory_regions (struct gdbarch *gdbarch, gdbarch_find_memory_regions_ftype *find_memory_regions); |
+ |
/* Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from |
core file into buffer READBUF with length LEN. */ |
@@ -754,7 +787,7 @@ typedef void (gdbarch_skip_permanent_breakpoint_ftype) (struct regcache *regcach |
extern void gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache); |
extern void set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint); |
-/* The maximum length of an instruction on this architecture. */ |
+/* The maximum length of an instruction on this architecture in bytes. */ |
extern int gdbarch_max_insn_length_p (struct gdbarch *gdbarch); |
@@ -893,8 +926,8 @@ extern void set_gdbarch_core_read_description (struct gdbarch *gdbarch, gdbarch_ |
extern int gdbarch_static_transform_name_p (struct gdbarch *gdbarch); |
-typedef char * (gdbarch_static_transform_name_ftype) (char *name); |
-extern char * gdbarch_static_transform_name (struct gdbarch *gdbarch, char *name); |
+typedef const char * (gdbarch_static_transform_name_ftype) (const char *name); |
+extern const char * gdbarch_static_transform_name (struct gdbarch *gdbarch, const char *name); |
extern void set_gdbarch_static_transform_name (struct gdbarch *gdbarch, gdbarch_static_transform_name_ftype *static_transform_name); |
/* Set if the address in N_SO or N_FUN stabs may be zero. */ |
@@ -918,23 +951,23 @@ extern void set_gdbarch_process_record (struct gdbarch *gdbarch, gdbarch_process |
extern int gdbarch_process_record_signal_p (struct gdbarch *gdbarch); |
-typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal); |
-extern int gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal); |
+typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal); |
+extern int gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal); |
extern void set_gdbarch_process_record_signal (struct gdbarch *gdbarch, gdbarch_process_record_signal_ftype *process_record_signal); |
-/* Signal translation: translate inferior's signal (host's) number into |
- GDB's representation. */ |
+/* Signal translation: translate inferior's signal (target's) number |
+ into GDB's representation. The implementation of this method must |
+ be host independent. IOW, don't rely on symbols of the NAT_FILE |
+ header (the nm-*.h files), the host <signal.h> header, or similar |
+ headers. This is mainly used when cross-debugging core files --- |
+ "Live" targets hide the translation behind the target interface |
+ (target_wait, target_resume, etc.). */ |
-typedef enum target_signal (gdbarch_target_signal_from_host_ftype) (struct gdbarch *gdbarch, int signo); |
-extern enum target_signal gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo); |
-extern void set_gdbarch_target_signal_from_host (struct gdbarch *gdbarch, gdbarch_target_signal_from_host_ftype *target_signal_from_host); |
+extern int gdbarch_gdb_signal_from_target_p (struct gdbarch *gdbarch); |
-/* Signal translation: translate GDB's signal number into inferior's host |
- signal number. */ |
- |
-typedef int (gdbarch_target_signal_to_host_ftype) (struct gdbarch *gdbarch, enum target_signal ts); |
-extern int gdbarch_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts); |
-extern void set_gdbarch_target_signal_to_host (struct gdbarch *gdbarch, gdbarch_target_signal_to_host_ftype *target_signal_to_host); |
+typedef enum gdb_signal (gdbarch_gdb_signal_from_target_ftype) (struct gdbarch *gdbarch, int signo); |
+extern enum gdb_signal gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, int signo); |
+extern void set_gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target); |
/* Extra signal info inspection. |
@@ -963,6 +996,125 @@ typedef LONGEST (gdbarch_get_syscall_number_ftype) (struct gdbarch *gdbarch, pti |
extern LONGEST gdbarch_get_syscall_number (struct gdbarch *gdbarch, ptid_t ptid); |
extern void set_gdbarch_get_syscall_number (struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype *get_syscall_number); |
+/* SystemTap related fields and functions. |
+ Prefix used to mark an integer constant on the architecture's assembly |
+ For example, on x86 integer constants are written as: |
+ |
+ $10 ;; integer constant 10 |
+ |
+ in this case, this prefix would be the character `$'. */ |
+ |
+extern const char * gdbarch_stap_integer_prefix (struct gdbarch *gdbarch); |
+extern void set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch, const char * stap_integer_prefix); |
+ |
+/* Suffix used to mark an integer constant on the architecture's assembly. */ |
+ |
+extern const char * gdbarch_stap_integer_suffix (struct gdbarch *gdbarch); |
+extern void set_gdbarch_stap_integer_suffix (struct gdbarch *gdbarch, const char * stap_integer_suffix); |
+ |
+/* Prefix used to mark a register name on the architecture's assembly. |
+ For example, on x86 the register name is written as: |
+ |
+ %eax ;; register eax |
+ |
+ in this case, this prefix would be the character `%'. */ |
+ |
+extern const char * gdbarch_stap_register_prefix (struct gdbarch *gdbarch); |
+extern void set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch, const char * stap_register_prefix); |
+ |
+/* Suffix used to mark a register name on the architecture's assembly */ |
+ |
+extern const char * gdbarch_stap_register_suffix (struct gdbarch *gdbarch); |
+extern void set_gdbarch_stap_register_suffix (struct gdbarch *gdbarch, const char * stap_register_suffix); |
+ |
+/* Prefix used to mark a register indirection on the architecture's assembly. |
+ For example, on x86 the register indirection is written as: |
+ |
+ (%eax) ;; indirecting eax |
+ |
+ in this case, this prefix would be the charater `('. |
+ |
+ Please note that we use the indirection prefix also for register |
+ displacement, e.g., `4(%eax)' on x86. */ |
+ |
+extern const char * gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch); |
+extern void set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch, const char * stap_register_indirection_prefix); |
+ |
+/* Suffix used to mark a register indirection on the architecture's assembly. |
+ For example, on x86 the register indirection is written as: |
+ |
+ (%eax) ;; indirecting eax |
+ |
+ in this case, this prefix would be the charater `)'. |
+ |
+ Please note that we use the indirection suffix also for register |
+ displacement, e.g., `4(%eax)' on x86. */ |
+ |
+extern const char * gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch); |
+extern void set_gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch, const char * stap_register_indirection_suffix); |
+ |
+/* Prefix used to name a register using GDB's nomenclature. |
+ |
+ For example, on PPC a register is represented by a number in the assembly |
+ language (e.g., `10' is the 10th general-purpose register). However, |
+ inside GDB this same register has an `r' appended to its name, so the 10th |
+ register would be represented as `r10' internally. */ |
+ |
+extern const char * gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch); |
+extern void set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch, const char * stap_gdb_register_prefix); |
+ |
+/* Suffix used to name a register using GDB's nomenclature. */ |
+ |
+extern const char * gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch); |
+extern void set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch, const char * stap_gdb_register_suffix); |
+ |
+/* Check if S is a single operand. |
+ |
+ Single operands can be: |
+ - Literal integers, e.g. `$10' on x86 |
+ - Register access, e.g. `%eax' on x86 |
+ - Register indirection, e.g. `(%eax)' on x86 |
+ - Register displacement, e.g. `4(%eax)' on x86 |
+ |
+ This function should check for these patterns on the string |
+ and return 1 if some were found, or zero otherwise. Please try to match |
+ as much info as you can from the string, i.e., if you have to match |
+ something like `(%', do not match just the `('. */ |
+ |
+extern int gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch); |
+ |
+typedef int (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch, const char *s); |
+extern int gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s); |
+extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype *stap_is_single_operand); |
+ |
+/* Function used to handle a "special case" in the parser. |
+ |
+ A "special case" is considered to be an unknown token, i.e., a token |
+ that the parser does not know how to parse. A good example of special |
+ case would be ARM's register displacement syntax: |
+ |
+ [R0, #4] ;; displacing R0 by 4 |
+ |
+ Since the parser assumes that a register displacement is of the form: |
+ |
+ <number> <indirection_prefix> <register_name> <indirection_suffix> |
+ |
+ it means that it will not be able to recognize and parse this odd syntax. |
+ Therefore, we should add a special case function that will handle this token. |
+ |
+ This function should generate the proper expression form of the expression |
+ using GDB's internal expression mechanism (e.g., `write_exp_elt_opcode' |
+ and so on). It should also return 1 if the parsing was successful, or zero |
+ if the token was not recognized as a special token (in this case, returning |
+ zero means that the special parser is deferring the parsing to the generic |
+ parser), and should advance the buffer pointer (p->arg). */ |
+ |
+extern int gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch); |
+ |
+typedef int (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p); |
+extern int gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p); |
+extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token); |
+ |
/* True if the list of shared libraries is one and only for all |
processes, as opposed to a list of shared libraries per inferior. |
This usually means that all processes, although may or may not share |
@@ -1031,6 +1183,32 @@ typedef void (gdbarch_gen_return_address_ftype) (struct gdbarch *gdbarch, struct |
extern void gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope); |
extern void set_gdbarch_gen_return_address (struct gdbarch *gdbarch, gdbarch_gen_return_address_ftype *gen_return_address); |
+/* Implement the "info proc" command. */ |
+ |
+extern int gdbarch_info_proc_p (struct gdbarch *gdbarch); |
+ |
+typedef void (gdbarch_info_proc_ftype) (struct gdbarch *gdbarch, char *args, enum info_proc_what what); |
+extern void gdbarch_info_proc (struct gdbarch *gdbarch, char *args, enum info_proc_what what); |
+extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ftype *info_proc); |
+ |
+/* Iterate over all objfiles in the order that makes the most sense |
+ for the architecture to make global symbol searches. |
+ |
+ CB is a callback function where OBJFILE is the objfile to be searched, |
+ and CB_DATA a pointer to user-defined data (the same data that is passed |
+ when calling this gdbarch method). The iteration stops if this function |
+ returns nonzero. |
+ |
+ CB_DATA is a pointer to some user-defined data to be passed to |
+ the callback. |
+ |
+ If not NULL, CURRENT_OBJFILE corresponds to the objfile being |
+ inspected when the symbol search was requested. */ |
+ |
+typedef void (gdbarch_iterate_over_objfiles_in_search_order_ftype) (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile); |
+extern void gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile); |
+extern void set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order); |
+ |
/* Definition for an unknown syscall, used basically in error-cases. */ |
#define UNKNOWN_SYSCALL (-1) |