diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-10-24 23:42:02 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-10-24 23:42:02 +0000 |
commit | abe28b921434c6ca63208f33a3b4a65b33f867f4 (patch) | |
tree | c4472ef325f51588ba8a936f10ea98fbcf44a7f2 /gdb/parse.c | |
parent | 94c74a0c226734e91d0d3e3812abe9142b8c3244 (diff) | |
download | gdb-abe28b921434c6ca63208f33a3b4a65b33f867f4.zip gdb-abe28b921434c6ca63208f33a3b4a65b33f867f4.tar.gz gdb-abe28b921434c6ca63208f33a3b4a65b33f867f4.tar.bz2 |
Sun Oct 24 20:16:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* parse.c, parser-defs.h (write_exp_msymbol): New function to write
the appropriate expression for a minimal symbol.
* c-exp.y, m2-exp.y: Use it.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r-- | gdb/parse.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/parse.c b/gdb/parse.c index 08f2b7e..0f3d351 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -338,6 +338,42 @@ write_exp_bitstring (str) expout_ptr += lenelt - 2; write_exp_elt_longcst ((LONGEST) bits); } + +/* Add the appropriate elements for a minimal symbol to the end of + the expression. */ + +void +write_exp_msymbol (msymbol, text_symbol_type, data_symbol_type) + struct minimal_symbol *msymbol; + struct type *text_symbol_type; + struct type *data_symbol_type; +{ + write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (builtin_type_long); + write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol)); + write_exp_elt_opcode (OP_LONG); + + write_exp_elt_opcode (UNOP_MEMVAL); + switch (msymbol -> type) + { + case mst_text: + case mst_file_text: + write_exp_elt_type (text_symbol_type); + break; + + case mst_data: + case mst_file_data: + case mst_bss: + case mst_file_bss: + write_exp_elt_type (data_symbol_type); + break; + + default: + write_exp_elt_type (builtin_type_char); + break; + } + write_exp_elt_opcode (UNOP_MEMVAL); +} /* Return a null-terminated temporary copy of the name of a string token. */ |