2005-07-12 21:06:54 +08:00
|
|
|
/* DWARF 2 location expression support for GDB.
|
|
|
|
|
2012-01-04 16:17:56 +08:00
|
|
|
Copyright (C) 2003, 2005, 2007-2012 Free Software Foundation, Inc.
|
Based on a patch from Daniel Berlin (dberlin@dberlin.org).
* symtab.h: Add opaque declarations of struct axs_value and
struct agent_expr.
(enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG.
(struct location_funcs): New type.
(struct symbol): Add "loc" to aux_value.
(SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros.
* dwarf2read.c: Include "dwarf2expr.h".
(dwarf2_symbol_mark_computed): New function.
(read_func_scope): Use it.
(var_decode_location): New function.
(new_symbol): Use it.
* dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files.
* Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c.
(dwarf2expr_h, dwarf2loc_h): New variables.
(COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o.
(dwarf2expr.o, dwarf2loc.o): New rules.
(dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h).
* buildsym.c (finish_block): Handle LOC_COMPUTED and
LOC_COMPUTED_ARG.
* findvar.c (symbol_read_needs_frame, read_var_value): Likewise.
* m2-exp.y (yylex): Likewise.
* printcmd.c (address_info, print_frame_args): Likewise.
* stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise.
* symmisc.c (print_symbol, print_partial_symbols): Likewise.
* ada-lang.c (ada_resolve_subexp, symtab_for_sym)
(ada_add_block_symbols, fill_in_ada_prototype): Likewise.
* symtab.c (lookup_block_symbol): Likewise.
2003-02-21 23:24:18 +08:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-24 02:08:50 +08:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
Based on a patch from Daniel Berlin (dberlin@dberlin.org).
* symtab.h: Add opaque declarations of struct axs_value and
struct agent_expr.
(enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG.
(struct location_funcs): New type.
(struct symbol): Add "loc" to aux_value.
(SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros.
* dwarf2read.c: Include "dwarf2expr.h".
(dwarf2_symbol_mark_computed): New function.
(read_func_scope): Use it.
(var_decode_location): New function.
(new_symbol): Use it.
* dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files.
* Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c.
(dwarf2expr_h, dwarf2loc_h): New variables.
(COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o.
(dwarf2expr.o, dwarf2loc.o): New rules.
(dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h).
* buildsym.c (finish_block): Handle LOC_COMPUTED and
LOC_COMPUTED_ARG.
* findvar.c (symbol_read_needs_frame, read_var_value): Likewise.
* m2-exp.y (yylex): Likewise.
* printcmd.c (address_info, print_frame_args): Likewise.
* stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise.
* symmisc.c (print_symbol, print_partial_symbols): Likewise.
* ada-lang.c (ada_resolve_subexp, symtab_for_sym)
(ada_add_block_symbols, fill_in_ada_prototype): Likewise.
* symtab.c (lookup_block_symbol): Likewise.
2003-02-21 23:24:18 +08:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-24 02:08:50 +08:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
Based on a patch from Daniel Berlin (dberlin@dberlin.org).
* symtab.h: Add opaque declarations of struct axs_value and
struct agent_expr.
(enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG.
(struct location_funcs): New type.
(struct symbol): Add "loc" to aux_value.
(SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros.
* dwarf2read.c: Include "dwarf2expr.h".
(dwarf2_symbol_mark_computed): New function.
(read_func_scope): Use it.
(var_decode_location): New function.
(new_symbol): Use it.
* dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files.
* Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c.
(dwarf2expr_h, dwarf2loc_h): New variables.
(COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o.
(dwarf2expr.o, dwarf2loc.o): New rules.
(dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h).
* buildsym.c (finish_block): Handle LOC_COMPUTED and
LOC_COMPUTED_ARG.
* findvar.c (symbol_read_needs_frame, read_var_value): Likewise.
* m2-exp.y (yylex): Likewise.
* printcmd.c (address_info, print_frame_args): Likewise.
* stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise.
* symmisc.c (print_symbol, print_partial_symbols): Likewise.
* ada-lang.c (ada_resolve_subexp, symtab_for_sym)
(ada_add_block_symbols, fill_in_ada_prototype): Likewise.
* symtab.c (lookup_block_symbol): Likewise.
2003-02-21 23:24:18 +08:00
|
|
|
|
|
|
|
#if !defined (DWARF2LOC_H)
|
|
|
|
#define DWARF2LOC_H
|
|
|
|
|
2009-06-04 20:28:39 +08:00
|
|
|
struct symbol_computed_ops;
|
2008-03-19 03:40:47 +08:00
|
|
|
struct objfile;
|
|
|
|
struct dwarf2_per_cu_data;
|
2010-11-30 05:18:16 +08:00
|
|
|
struct dwarf2_loclist_baton;
|
2011-02-18 00:20:44 +08:00
|
|
|
struct agent_expr;
|
|
|
|
struct axs_value;
|
2004-01-27 04:36:32 +08:00
|
|
|
|
Based on a patch from Daniel Berlin (dberlin@dberlin.org).
* symtab.h: Add opaque declarations of struct axs_value and
struct agent_expr.
(enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG.
(struct location_funcs): New type.
(struct symbol): Add "loc" to aux_value.
(SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros.
* dwarf2read.c: Include "dwarf2expr.h".
(dwarf2_symbol_mark_computed): New function.
(read_func_scope): Use it.
(var_decode_location): New function.
(new_symbol): Use it.
* dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files.
* Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c.
(dwarf2expr_h, dwarf2loc_h): New variables.
(COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o.
(dwarf2expr.o, dwarf2loc.o): New rules.
(dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h).
* buildsym.c (finish_block): Handle LOC_COMPUTED and
LOC_COMPUTED_ARG.
* findvar.c (symbol_read_needs_frame, read_var_value): Likewise.
* m2-exp.y (yylex): Likewise.
* printcmd.c (address_info, print_frame_args): Likewise.
* stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise.
* symmisc.c (print_symbol, print_partial_symbols): Likewise.
* ada-lang.c (ada_resolve_subexp, symtab_for_sym)
(ada_add_block_symbols, fill_in_ada_prototype): Likewise.
* symtab.c (lookup_block_symbol): Likewise.
2003-02-21 23:24:18 +08:00
|
|
|
/* This header is private to the DWARF-2 reader. It is shared between
|
|
|
|
dwarf2read.c and dwarf2loc.c. */
|
|
|
|
|
gdb/
Implement basic support for DW_TAG_GNU_call_site.
* block.c: Include gdbtypes.h and exceptions.h.
(call_site_for_pc): New function.
* block.h (call_site_for_pc): New declaration.
* defs.h: Include hashtab.h.
(make_cleanup_htab_delete, core_addr_hash, core_addr_eq): New
declarations.
* dwarf2-frame.c (dwarf2_frame_ctx_funcs): Install
ctx_no_push_dwarf_reg_entry_value.
* dwarf2expr.c (read_uleb128, read_sleb128): Support R as NULL.
(dwarf_block_to_dwarf_reg): New function.
(execute_stack_op) <DW_OP_GNU_entry_value>: Implement it.
(ctx_no_push_dwarf_reg_entry_value): New function.
* dwarf2expr.h (struct dwarf_expr_context_funcs): New field
push_dwarf_reg_entry_value.
(ctx_no_push_dwarf_reg_entry_value, dwarf_block_to_dwarf_reg): New
declarations.
* dwarf2loc.c: Include gdbcmd.h.
(dwarf_expr_ctx_funcs): New forward declaration.
(entry_values_debug, show_entry_values_debug, call_site_to_target_addr)
(dwarf_expr_reg_to_entry_parameter)
(dwarf_expr_push_dwarf_reg_entry_value): New.
(dwarf_expr_ctx_funcs): Install dwarf_expr_push_dwarf_reg_entry_value.
(dwarf2_evaluate_loc_desc_full): Handle NO_ENTRY_VALUE_ERROR.
(needs_dwarf_reg_entry_value): New function.
(needs_frame_ctx_funcs): Install it.
(_initialize_dwarf2loc): New function.
* dwarf2loc.h (entry_values_debug): New declaration.
* dwarf2read.c (struct dwarf2_cu): New field call_site_htab.
(read_call_site_scope): New forward declaration.
(process_full_comp_unit): Copy call_site_htab.
(process_die): Support DW_TAG_GNU_call_site.
(read_call_site_scope): New function.
(dwarf2_get_pc_bounds): Support NULL HIGHPC.
(dwarf_tag_name): Support DW_TAG_GNU_call_site.
(cleanup_htab): Delete.
(write_psymtabs_to_index): Use make_cleanup_htab_delete instead of it.
* exceptions.h (enum errors): New NO_ENTRY_VALUE_ERROR.
* gdb-gdb.py (StructMainTypePrettyPrinter): Support
FIELD_LOC_KIND_DWARF_BLOCK.
* gdbtypes.h (enum field_loc_kind): New entry
FIELD_LOC_KIND_DWARF_BLOCK.
(struct main_type): New loc entry dwarf_block.
(struct call_site, FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK)
(TYPE_FIELD_DWARF_BLOCK): New.
* python/py-type.c: Include dwarf2loc.h.
(check_types_equal): Support FIELD_LOC_KIND_DWARF_BLOCK. New
internal_error call on unknown FIELD_LOC_KIND.
* symtab.h (struct symtab): New field call_site_htab.
* utils.c (do_htab_delete_cleanup, make_cleanup_htab_delete)
(core_addr_hash, core_addr_eq): New functions.
gdb/testsuite/
Implement basic support for DW_TAG_GNU_call_site.
* gdb.arch/Makefile.in (EXECUTABLES): Add amd64-entry-value.
* gdb.arch/amd64-entry-value.cc: New file.
* gdb.arch/amd64-entry-value.exp: New file.
2011-10-10 03:21:39 +08:00
|
|
|
/* `set debug entry-values' setting. */
|
|
|
|
extern int entry_values_debug;
|
|
|
|
|
2010-07-13 23:09:03 +08:00
|
|
|
/* Return the OBJFILE associated with the compilation unit CU. If CU
|
|
|
|
came from a separate debuginfo file, then the master objfile is
|
|
|
|
returned. */
|
2008-03-19 03:40:47 +08:00
|
|
|
struct objfile *dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *cu);
|
|
|
|
|
|
|
|
/* Return the address size given in the compilation unit header for CU. */
|
2012-01-06 05:53:14 +08:00
|
|
|
int dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *cu);
|
2008-03-19 03:40:47 +08:00
|
|
|
|
2011-10-10 02:46:41 +08:00
|
|
|
/* Return the DW_FORM_ref_addr size given in the compilation unit header for
|
|
|
|
CU. */
|
|
|
|
int dwarf2_per_cu_ref_addr_size (struct dwarf2_per_cu_data *cu);
|
|
|
|
|
2010-06-03 03:37:56 +08:00
|
|
|
/* Return the offset size given in the compilation unit header for CU. */
|
|
|
|
int dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *cu);
|
|
|
|
|
2010-07-13 23:09:03 +08:00
|
|
|
/* Return the text offset of the CU. The returned offset comes from
|
|
|
|
this CU's objfile. If this objfile came from a separate debuginfo
|
|
|
|
file, then the offset may be different from the corresponding
|
|
|
|
offset in the parent objfile. */
|
|
|
|
CORE_ADDR dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *cu);
|
|
|
|
|
2010-11-30 05:18:16 +08:00
|
|
|
/* Find a particular location expression from a location list. */
|
|
|
|
const gdb_byte *dwarf2_find_location_expression
|
|
|
|
(struct dwarf2_loclist_baton *baton,
|
|
|
|
size_t *locexpr_length,
|
|
|
|
CORE_ADDR pc);
|
|
|
|
|
2010-06-08 03:55:33 +08:00
|
|
|
struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block
|
2010-11-30 05:18:16 +08:00
|
|
|
(unsigned int offset, struct dwarf2_per_cu_data *per_cu,
|
|
|
|
CORE_ADDR (*get_frame_pc) (void *baton),
|
|
|
|
void *baton);
|
2010-06-08 03:55:33 +08:00
|
|
|
|
2011-05-13 01:40:55 +08:00
|
|
|
struct type *dwarf2_get_die_type (unsigned int die_offset,
|
|
|
|
struct dwarf2_per_cu_data *per_cu);
|
|
|
|
|
2010-08-13 03:55:38 +08:00
|
|
|
/* Evaluate a location description, starting at DATA and with length
|
|
|
|
SIZE, to find the current location of variable of TYPE in the context
|
|
|
|
of FRAME. */
|
|
|
|
|
|
|
|
struct value *dwarf2_evaluate_loc_desc (struct type *type,
|
|
|
|
struct frame_info *frame,
|
|
|
|
const gdb_byte *data,
|
|
|
|
unsigned short size,
|
|
|
|
struct dwarf2_per_cu_data *per_cu);
|
|
|
|
|
2003-04-13 23:43:35 +08:00
|
|
|
/* The symbol location baton types used by the DWARF-2 reader (i.e.
|
|
|
|
SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct
|
|
|
|
dwarf2_locexpr_baton" is for a symbol with a single location
|
|
|
|
expression; "struct dwarf2_loclist_baton" is for a symbol with a
|
|
|
|
location list. */
|
Based on a patch from Daniel Berlin (dberlin@dberlin.org).
* symtab.h: Add opaque declarations of struct axs_value and
struct agent_expr.
(enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG.
(struct location_funcs): New type.
(struct symbol): Add "loc" to aux_value.
(SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros.
* dwarf2read.c: Include "dwarf2expr.h".
(dwarf2_symbol_mark_computed): New function.
(read_func_scope): Use it.
(var_decode_location): New function.
(new_symbol): Use it.
* dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files.
* Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c.
(dwarf2expr_h, dwarf2loc_h): New variables.
(COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o.
(dwarf2expr.o, dwarf2loc.o): New rules.
(dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h).
* buildsym.c (finish_block): Handle LOC_COMPUTED and
LOC_COMPUTED_ARG.
* findvar.c (symbol_read_needs_frame, read_var_value): Likewise.
* m2-exp.y (yylex): Likewise.
* printcmd.c (address_info, print_frame_args): Likewise.
* stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise.
* symmisc.c (print_symbol, print_partial_symbols): Likewise.
* ada-lang.c (ada_resolve_subexp, symtab_for_sym)
(ada_add_block_symbols, fill_in_ada_prototype): Likewise.
* symtab.c (lookup_block_symbol): Likewise.
2003-02-21 23:24:18 +08:00
|
|
|
|
|
|
|
struct dwarf2_locexpr_baton
|
|
|
|
{
|
2011-10-13 06:04:12 +08:00
|
|
|
/* Pointer to the start of the location expression. Valid only if SIZE is
|
|
|
|
not zero. */
|
2010-05-26 23:21:13 +08:00
|
|
|
const gdb_byte *data;
|
2003-04-13 23:43:35 +08:00
|
|
|
|
2011-10-13 06:04:12 +08:00
|
|
|
/* Length of the location expression. For optimized out expressions it is
|
|
|
|
zero. */
|
2007-01-28 09:38:40 +08:00
|
|
|
unsigned long size;
|
2003-04-13 23:43:35 +08:00
|
|
|
|
2008-03-19 03:40:47 +08:00
|
|
|
/* The compilation unit containing the symbol whose location
|
|
|
|
we're computing. */
|
|
|
|
struct dwarf2_per_cu_data *per_cu;
|
2003-04-13 23:43:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct dwarf2_loclist_baton
|
|
|
|
{
|
|
|
|
/* The initial base address for the location list, based on the compilation
|
|
|
|
unit. */
|
|
|
|
CORE_ADDR base_address;
|
|
|
|
|
|
|
|
/* Pointer to the start of the location list. */
|
2010-05-26 23:21:13 +08:00
|
|
|
const gdb_byte *data;
|
2003-04-13 23:43:35 +08:00
|
|
|
|
|
|
|
/* Length of the location list. */
|
2007-01-28 09:38:40 +08:00
|
|
|
unsigned long size;
|
2003-04-13 23:43:35 +08:00
|
|
|
|
2008-03-19 03:40:47 +08:00
|
|
|
/* The compilation unit containing the symbol whose location
|
|
|
|
we're computing. */
|
|
|
|
struct dwarf2_per_cu_data *per_cu;
|
Based on a patch from Daniel Berlin (dberlin@dberlin.org).
* symtab.h: Add opaque declarations of struct axs_value and
struct agent_expr.
(enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG.
(struct location_funcs): New type.
(struct symbol): Add "loc" to aux_value.
(SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros.
* dwarf2read.c: Include "dwarf2expr.h".
(dwarf2_symbol_mark_computed): New function.
(read_func_scope): Use it.
(var_decode_location): New function.
(new_symbol): Use it.
* dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files.
* Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c.
(dwarf2expr_h, dwarf2loc_h): New variables.
(COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o.
(dwarf2expr.o, dwarf2loc.o): New rules.
(dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h).
* buildsym.c (finish_block): Handle LOC_COMPUTED and
LOC_COMPUTED_ARG.
* findvar.c (symbol_read_needs_frame, read_var_value): Likewise.
* m2-exp.y (yylex): Likewise.
* printcmd.c (address_info, print_frame_args): Likewise.
* stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise.
* symmisc.c (print_symbol, print_partial_symbols): Likewise.
* ada-lang.c (ada_resolve_subexp, symtab_for_sym)
(ada_add_block_symbols, fill_in_ada_prototype): Likewise.
* symtab.c (lookup_block_symbol): Likewise.
2003-02-21 23:24:18 +08:00
|
|
|
};
|
|
|
|
|
2009-06-04 20:28:39 +08:00
|
|
|
extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
|
|
|
|
extern const struct symbol_computed_ops dwarf2_loclist_funcs;
|
Based on a patch from Daniel Berlin (dberlin@dberlin.org).
* symtab.h: Add opaque declarations of struct axs_value and
struct agent_expr.
(enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG.
(struct location_funcs): New type.
(struct symbol): Add "loc" to aux_value.
(SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros.
* dwarf2read.c: Include "dwarf2expr.h".
(dwarf2_symbol_mark_computed): New function.
(read_func_scope): Use it.
(var_decode_location): New function.
(new_symbol): Use it.
* dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files.
* Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c.
(dwarf2expr_h, dwarf2loc_h): New variables.
(COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o.
(dwarf2expr.o, dwarf2loc.o): New rules.
(dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h).
* buildsym.c (finish_block): Handle LOC_COMPUTED and
LOC_COMPUTED_ARG.
* findvar.c (symbol_read_needs_frame, read_var_value): Likewise.
* m2-exp.y (yylex): Likewise.
* printcmd.c (address_info, print_frame_args): Likewise.
* stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise.
* symmisc.c (print_symbol, print_partial_symbols): Likewise.
* ada-lang.c (ada_resolve_subexp, symtab_for_sym)
(ada_add_block_symbols, fill_in_ada_prototype): Likewise.
* symtab.c (lookup_block_symbol): Likewise.
2003-02-21 23:24:18 +08:00
|
|
|
|
2011-02-18 00:20:44 +08:00
|
|
|
/* Compile a DWARF location expression to an agent expression.
|
|
|
|
|
|
|
|
EXPR is the agent expression we are building.
|
|
|
|
LOC is the agent value we modify.
|
|
|
|
ARCH is the architecture.
|
|
|
|
ADDR_SIZE is the size of addresses, in bytes.
|
|
|
|
OP_PTR is the start of the location expression.
|
|
|
|
OP_END is one past the last byte of the location expression.
|
|
|
|
|
|
|
|
This will throw an exception for various kinds of errors -- for
|
|
|
|
example, if the expression cannot be compiled, or if the expression
|
|
|
|
is invalid. */
|
|
|
|
|
|
|
|
extern void dwarf2_compile_expr_to_ax (struct agent_expr *expr,
|
|
|
|
struct axs_value *loc,
|
|
|
|
struct gdbarch *arch,
|
|
|
|
unsigned int addr_size,
|
|
|
|
const gdb_byte *op_ptr,
|
|
|
|
const gdb_byte *op_end,
|
|
|
|
struct dwarf2_per_cu_data *per_cu);
|
|
|
|
|
gdb/
Recognize virtual tail call frames.
* Makefile.in (SFILES): Add dwarf2-frame-tailcall.c.
(HFILES_NO_SRCDIR): Add dwarf2-frame-tailcall.h.
(COMMON_OBS): Add dwarf2-frame-tailcall.o.
* dwarf2-frame-tailcall.c: New file.
* dwarf2-frame-tailcall.h: New file.
* dwarf2-frame.c: Include dwarf2-frame-tailcall.h.
(execute_cfa_program): New function comment. Return INSN_PTR. Reset
REGS.PREV only after CIE execution.
(struct dwarf2_frame_cache): New field tailcall_cache.
(dwarf2_frame_cache): New variables entry_pc, entry_cfa_sp_offset,
entry_cfa_sp_offset_p and instr. Execute FDE instructions in two
parts, try to find entry_cfa_sp_offset. Call
dwarf2_tailcall_sniffer_first.
(dwarf2_frame_prev_register): Call dwarf2_tailcall_prev_register_first
when appropriate.
(dwarf2_frame_dealloc_cache): New function.
(dwarf2_frame_sniffer): Preinitialize cache by dwarf2_frame_cache.
(dwarf2_frame_unwind): Install dwarf2_frame_dealloc_cache.
(dwarf2_signal_frame_unwind): Do not install dwarf2_frame_dealloc_cache.
(dwarf2_append_unwinders): Add dwarf2_tailcall_frame_unwind.
(dwarf2_frame_cfa): Support also dwarf2_tailcall_frame_unwind.
* dwarf2loc.c (func_addr_to_tail_call_list)
(tailcall_dump, call_sitep, VEC (call_sitep), chain_candidate)
(call_site_find_chain_1, call_site_find_chain): New.
* dwarf2loc.h (struct call_site_chain): New.
(call_site_find_chain): New declaration.
* frame.c (get_frame_address_in_block): Support also TAILCALL_FRAME.
* frame.h (enum frame_type): New entry TAILCALL_FRAME.
* python/py-frame.c (gdbpy_initialize_frames): Add TAILCALL_FRAME.
* stack.c (frame_info): Support also TAILCALL_FRAME.
gdb/doc/
Recognize virtual tail call frames.
* gdb.texinfo (Optimized Code): Add reference to Tail Call Frames.
(Tail Call Frames): New node.
(Frames In Python): Add gdb.TAILCALL_FRAME.
gdb/testsuite/
Recognize virtual tail call frames.
* gdb.arch/amd64-entry-value.cc (c, a, b, amb_z, amb_y, amb_x, amb)
(amb_b, amb_a): New.
(main): Call a and b.
* gdb.arch/amd64-entry-value.exp (tailcall: breakhere, tailcall: bt)
(tailcall: p i, tailcall: p j, set $sp0=$sp, up, p $sp0 == $sp, frame 3)
(p $sp0 + sizeof (void *) == $sp, ambiguous: breakhere, ambiguous: bt):
New tests.
2011-10-10 03:26:44 +08:00
|
|
|
/* Determined tail calls for constructing virtual tail call frames. */
|
|
|
|
|
|
|
|
struct call_site_chain
|
|
|
|
{
|
|
|
|
/* Initially CALLERS == CALLEES == LENGTH. For partially ambiguous result
|
|
|
|
CALLERS + CALLEES < LENGTH. */
|
|
|
|
int callers, callees, length;
|
|
|
|
|
|
|
|
/* Variably sized array with LENGTH elements. Later [0..CALLERS-1] contain
|
|
|
|
top (GDB "prev") sites and [LENGTH-CALLEES..LENGTH-1] contain bottom
|
|
|
|
(GDB "next") sites. One is interested primarily in the PC field. */
|
|
|
|
struct call_site *call_site[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct call_site_stuff;
|
|
|
|
extern struct call_site_chain *call_site_find_chain (struct gdbarch *gdbarch,
|
|
|
|
CORE_ADDR caller_pc,
|
|
|
|
CORE_ADDR callee_pc);
|
|
|
|
|
2005-07-12 21:06:54 +08:00
|
|
|
#endif /* dwarf2loc.h */
|