diff options
Diffstat (limited to 'gdb/linespec.h')
-rw-r--r-- | gdb/linespec.h | 114 |
1 files changed, 103 insertions, 11 deletions
diff --git a/gdb/linespec.h b/gdb/linespec.h index 3c86af3..401158c 100644 --- a/gdb/linespec.h +++ b/gdb/linespec.h @@ -20,8 +20,44 @@ struct symtab; +#include "vec.h" + +/* Flags to pass to decode_line_1 and decode_line_full. */ + +enum decode_line_flags + { + /* Set this flag if you want the resulting SALs to describe the + first line of indicated functions. */ + DECODE_LINE_FUNFIRSTLINE = 1, + + /* Set this flag if you want "list mode". In this mode, a + FILE:LINE linespec will always return a result, and such + linespecs will not be expanded to all matches. */ + DECODE_LINE_LIST_MODE = 2 + }; + +/* decode_line_full returns a vector of these. */ + +struct linespec_sals +{ + /* This is the linespec corresponding to the sals contained in this + object. It can be passed as the FILTER argument to future calls + to decode_line_full. This is freed by + destroy_linespec_result. */ + char *canonical; + + /* Sals. The 'sals' field is destroyed by + destroy_linespec_result. */ + struct symtabs_and_lines sals; +}; + +typedef struct linespec_sals linespec_sals; +DEF_VEC_O (linespec_sals); + /* An instance of this may be filled in by decode_line_1. The caller - must call init_linespec_result to initialize it. */ + must call init_linespec_result to initialize it and + destroy_linespec_result to destroy it. The caller must make copies + of any data that it needs to keep. */ struct linespec_result { @@ -30,22 +66,78 @@ struct linespec_result display mechanism would do the wrong thing. */ int special_display; - /* If non-NULL, an array of canonical names for returned - symtab_and_line objects. The array has as many elements as the - `nelts' field in the symtabs_and_line returned by decode_line_1. - An element in the array may be NULL. The array and each non-NULL - element in it are allocated with xmalloc and must be freed by the - caller. */ - char **canonical; + /* If non-zero, the linespec result should be considered to be a + "pre-expanded" multi-location linespec. A pre-expanded linespec + holds all matching locations in a single linespec_sals + object. */ + int pre_expanded; + + /* If PRE_EXPANDED is non-zero, this is set to the linespec entered + by the user. This will be freed by destroy_linespec_result. */ + char *addr_string; + + /* The sals. The vector will be freed by + destroy_linespec_result. */ + VEC (linespec_sals) *sals; }; /* Initialize a linespec_result. */ extern void init_linespec_result (struct linespec_result *); +/* Destroy a linespec_result. */ + +extern void destroy_linespec_result (struct linespec_result *); + +/* Return a cleanup that destroys a linespec_result. */ + +extern struct cleanup * + make_cleanup_destroy_linespec_result (struct linespec_result *); + extern struct symtabs_and_lines - decode_line_1 (char **argptr, int funfirstline, - struct symtab *default_symtab, int default_line, - struct linespec_result *canonical); + decode_line_1 (char **argptr, int flags, + struct symtab *default_symtab, int default_line); + +/* Parse *ARGPTR as a linespec and return results. This is the "full" + interface to this module, which handles multiple results + properly. + + For FLAGS, see decode_line_flags. DECODE_LINE_LIST_MODE is not + valid for this function. + + DEFAULT_SYMTAB and DEFAULT_LINE describe the default location. + DEFAULT_SYMTAB can be NULL, in which case the current symtab and + line are used. + + CANONICAL is where the results are stored. It must not be NULL. + + SELECT_MODE must be one of the multiple_symbols_* constants, or + NULL. It determines how multiple results will be handled. If + NULL, the appropriate CLI value will be used. + + FILTER can either be NULL or a string holding a canonical name. + This is only valid when SELECT_MODE is multiple_symbols_all. + + Multiple results are handled differently depending on the + arguments: + + . With multiple_symbols_cancel, an exception is thrown. + + . With multiple_symbols_ask, a menu is presented to the user. The + user may select none, in which case an exception is thrown; or all, + which is handled like multiple_symbols_all, below. Otherwise, + CANONICAL->SALS will have one entry for each name the user chose. + + . With multiple_symbols_all, CANONICAL->SALS will have a single + entry describing all the matching locations. If FILTER is + non-NULL, then only locations whose canonical name is equal (in the + strcmp sense) to FILTER will be returned; all others will be + filtered out. */ + +extern void decode_line_full (char **argptr, int flags, + struct symtab *default_symtab, int default_line, + struct linespec_result *canonical, + const char *select_mode, + const char *filter); #endif /* defined (LINESPEC_H) */ |