Commit Graph

28 Commits

Author SHA1 Message Date
Tom Tromey 007e153034 Handle alignof and _Alignof
This adds alignof and _Alignof to the C/C++ expression parser, and
adds new tests to test the features.  The tests are written to try to
ensure that gdb's knowledge of alignment rules stays in sync with the
compiler's.

2018-04-30  Tom Tromey  <tom@tromey.com>

	PR exp/17095:
	* NEWS: Update.
	* std-operator.def (UNOP_ALIGNOF): New operator.
	* expprint.c (dump_subexp_body_standard) <case UNOP_ALIGNOF>:
	New.
	* eval.c (evaluate_subexp_standard) <case UNOP_ALIGNOF>: New.
	* c-lang.c (c_op_print_tab): Add alignof.
	* c-exp.y (ALIGNOF): New token.
	(exp): Add "ALIGNOF" production.
	(ident_tokens): Add _Alignof and alignof.

2018-04-30  Tom Tromey  <tom@tromey.com>

	PR exp/17095:
	* gdb.dwarf2/dw2-align.exp: New file.
	* gdb.cp/align.exp: New file.
	* gdb.base/align.exp: New file.
	* lib/gdb.exp (gdb_int128_helper): New proc.
	(has_int128_c, has_int128_cxx): New caching procs.
2018-04-30 11:25:31 -06:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Ulrich Weigand edd079d9f6 Target FP: Use target format throughout expression parsing
When parsing floating-point literals, the language parsers currently
use parse_float or some equivalent routine to parse the input string
into a DOUBLEST, which is then stored within a OP_DOUBLE expression
node.  When evaluating the expression, the OP_DOUBLE is finally
converted into a value in target format.

On the other hand, *decimal* floating-point literals are parsed
directly into target format and stored that way in a OP_DECFLOAT
expression node.  In order to eliminate the DOUBLEST, this patch
therefore unifies the handling of binary and decimal floating-
point literals and stores them both in target format within a
new OP_FLOAT expression node, replacing both OP_DOUBLE and
OP_DECFLOAT.

In order to store literals in target format, the parse_float
routine needs to know the type of the literal.  All parsers
therefore need to be changed to determine the appropriate type
(e.g. by detecting suffixes) *before* calling parse_float,
instead of after it as today.  However, this change is mostly
straightforward -- again, this is already done for decimal FP
today.

The core of the literal parsing is moved into a new routine
floatformat_from_string, mirroring floatformat_to_string.
The parse_float routine now calls either floatformat_from_string
or decimal_from_sting, allowing it to handle any type of FP
literal.

All language parsers need to be updated.  Some notes on
specific changes to the various languages:

- C: Decimal FP is now handled in parse_float, and no longer
  needs to be handled specially.

- D: Straightforward.

- Fortran: Still used a hard-coded "atof", also replaced by
  parse_float now.  Continues to always use builtin_real_s8
  as the type of literal, even though this is probably wrong.

- Go: This used to handle "f" and "l" suffixes, even though
  the Go language actually doesn't support those.  I kept this
  support for now -- maybe revisit later.  Note the the GDB
  test suite for some reason actually *verifies* that GDB supports
  those unsupported suffixes ...

- Pascal: Likewise -- this handles suffixes that are not
  supported in the language standard.

- Modula-2: Like Fortran, used to use "atof".

- Rust: Mostly straightforward, except for a unit-testing hitch.
  The code use to set a special "unit_testing" flag which would
  cause "rust_type" to always return NULL.  This makes it not
  possible to encode a literal into target format (which type?).
  The reason for this flag appears to have been that during
  unit testing, there is no "rust_parser" context set up, which
  means no "gdbarch" is available to use its types.  To fix this,
  I removed the unit_testing flag, and instead simply just set up
  a dummy rust_parser context during unit testing.

- Ada: This used to check sizeof (DOUBLEST) to determine which
  type to use for floating-point literal.  This seems questionable
  to begin with (since DOUBLEST is quite unrelated to target formats),
  and in any case we need to get rid of DOUBLEST.  I'm now simply
  always using the largest type (builtin_long_double).

gdb/ChangeLog:
2017-10-25  Ulrich Weigand  <uweigand@de.ibm.com>

	* doublest.c (floatformat_from_string): New function.
	* doublest.h (floatformat_from_string): Add prototype.

	* std-operator.def (OP_DOUBLE, OP_DECFLOAT): Remove, replace by ...
	(OP_FLOAT): ... this.
	* expression.h: Do not include "doublest.h".
	(union exp_element): Replace doubleconst and decfloatconst by
	new element floatconst.
	* ada-lang.c (resolve_subexp): Handle OP_FLOAT instead of OP_DOUBLE.
	(ada_evaluate_subexp): Likewise.
	* eval.c (evaluate_subexp_standard): Handle OP_FLOAT instead of
	OP_DOUBLE and OP_DECFLOAT.
	* expprint.c (print_subexp_standard): Likewise.
	(dump_subexp_body_standard): Likewise.
	* breakpoint.c (watchpoint_exp_is_const): Likewise.

	* parse.c: Include "dfp.h".
	(write_exp_elt_dblcst, write_exp_elt_decfloatcst): Remove.
	(write_exp_elt_floatcst): New function.
	(operator_length_standard): Handle OP_FLOAT instead of OP_DOUBLE
	and OP_DECFLOAT.
	(operator_check_standard): Likewise.
	(parse_float): Do not accept suffix.  Take type as input.  Return bool.
	Return target format buffer instead of host DOUBLEST.
	Use floatformat_from_string and decimal_from_string to parse
	either binary or decimal floating-point types.
	(parse_c_float): Remove.
	* parser-defs.h: Do not include "doublest.h".
	(write_exp_elt_dblcst, write_exp_elt_decfloatcst): Remove.
	(write_exp_elt_floatcst): Add prototype.
	(parse_float): Update prototype.
	(parse_c_float): Remove.

	* c-exp.y: Do not include "dfp.h".
	(typed_val_float): Use byte buffer instead of DOUBLEST.
	(typed_val_decfloat): Remove.
	(DECFLOAT): Remove.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Update to new parse_float interface.
	Parse suffixes and determine type before calling parse_float.
	Handle decimal and binary FP types the same way.

	* d-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
	(FLOAT_LITERAL): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Update to new parse_float interface.
	Parse suffixes and determine type before calling parse_float.

	* f-exp.y: Replace dval by typed_val_float.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Use parse_float instead of atof.

	* go-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
	(parse_go_float): Remove.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Call parse_float instead of parse_go_float.
	Parse suffixes and determine type before calling parse_float.

	* p-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Update to new parse_float interface.
	Parse suffixes and determine type before calling parse_float.

	* m2-exp.y: Replace dval by byte buffer val.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Call parse_float instead of atof.

	* rust-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
	(lex_number): Call parse_float instead of strtod.
	(ast_dliteral): Use OP_FLOAT instead of OP_DOUBLE.
	(convert_ast_to_expression): Handle OP_FLOAT instead of OP_DOUBLE.
	Use write_exp_elt_floatcst.
	(unit_testing): Remove static variable.
	(rust_type): Do not check unit_testing.
	(rust_lex_tests): Do not set uint_testing.  Set up dummy rust_parser.

	* ada-exp.y (type_float, type_double): Remove.
	(typed_val_float): Use byte buffer instead of DOUBLEST.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	* ada-lex.l (processReal): Use parse_float instead of sscanf.
2017-10-25 15:32:23 +02:00
Pedro Alves e68cb8e001 Handle "p 'S::method()::static_var'" (quoted) in symbol lookup
While the previous commit made "p method()::static_var" (no
single-quotes) Just Work, if users (or frontends) try wrapping the
expression with quotes, they'll get:

  (gdb) p 'S::method()::static_var'
  'S::method()::static_var' has unknown type; cast it to its declared type

even if we _do_ have debug info for that variable.  That's better than
the bogus/confusing value what GDB would print before the
stop-assuming-int patch:

  (gdb) p 'S::method()::static_var'
  $1 = 1

but I think it'd still be nice to make this case Just Work too.

In this case, due to the quoting, the C/C++ parser (c-exp.y)
interprets the whole expression/string as a single symbol name, and we
end up calling lookup_symbol on that name.  There's no debug symbol
with that fully-qualified name, but since the compiler gives the
static variable a mangled linkage name exactly like the above, it
appears in the mininal symbols:

  $ nm -A local-static | c++filt | grep static_var
  local-static:0000000000601040 d S::method()::static_var

... and that's what GDB happens to find/print.  This only happens in
C++, note, since for C the compiler uses different linkage names:

  local-static-c:0000000000601040 d static_var.1848

So while (in C++, not C) function local static variables are given a
mangled name that demangles to the same syntax that GDB
documents/expects as the way to access function local statics, there's
no global symbol in the debug info with that name at all.  The debug
info for a static local variable for a non-inline function looks like
this:

 <1><2a1>: Abbrev Number: 19 (DW_TAG_subprogram)
 ...
 <2><2f7>: Abbrev Number: 20 (DW_TAG_variable)
    <2f8>   DW_AT_name        : (indirect string, offset: 0x4e9): static_var
    <2fc>   DW_AT_decl_file   : 1
    <2fd>   DW_AT_decl_line   : 64
    <2fe>   DW_AT_type        : <0x25>
    <302>   DW_AT_location    : 9 byte block: 3 40 10 60 0 0 0 0 0      (DW_OP_addr: 601040)

and for an inline function, it looks like this (linkage name run
through c++filt for convenience):

 <2><21b>: Abbrev Number: 16 (DW_TAG_variable)
    <21c>   DW_AT_name        : (indirect string, offset: 0x21a): static_var
    <220>   DW_AT_decl_file   : 1
    <221>   DW_AT_decl_line   : 48
    <222>   DW_AT_linkage_name: (indirect string, offset: 0x200): S::inline_method()::static_var
    <226>   DW_AT_type        : <0x25>
    <22a>   DW_AT_external    : 1
    <22a>   DW_AT_location    : 9 byte block: 3 a0 10 60 0 0 0 0 0      (DW_OP_addr: 6010a0)

(The inline case makes the variable external so that the linker can
merge the different inlined copies.  It seems like GCC never outputs
the linkage name for non-extern globals.)

When we read the DWARF, we record the static_var variable as a regular
variable of the containing function's block.  This makes stopping in
the function and printing the variable as usual.  The variable just so
happens to have a memory address as location.

So one way to make "p 'S::method()::static_var'" work would be to
record _two_ copies of the symbols for these variables.  One in the
function's scope/block, with "static_var" as name, as we currently do,
and another in the static or global blocks (depending on whether the
symbol is external), with a fully-qualified name.  I wrote a prototype
patch for that, and it works.  For the non-inline case above, since
the debug info doesn't point to the linkage same, that patch built the
physname of the static local variable as the concat of the physname of
the containing function, plus "::", plus the variable's name.  We
could make that approach work for C too, though it kind of feels
awkward to record fake symbol names like that in C.

The other approach I tried is to change the C++ symbol lookup routines
instead.  This is the approach this commit takes.  We can already
lookup up symbol in namespaces and classes, so this feels like a good
fit, and was easy enough.  The advantage is that this doesn't require
recording extra symbols.

The test in gdb.cp/m-static.exp that exposed the need for this is
removed, since the same functionality is now covered by
gdb.cp/local-static.exp.

gdb/ChangeLog:
2017-09-04  Pedro Alves  <palves@redhat.com>

	* cp-namespace.c (cp_search_static_and_baseclasses): Handle
	function/method scopes; lookup the nested name as a function local
	static variable.

gdb/testsuite/ChangeLog:
2017-09-04  Pedro Alves  <palves@redhat.com>

	* gdb.base/local-static.exp: Also test with
	class::method::variable wholly quoted.
	* gdb.cp/m-static.exp (class::method::variable): Remove test.
2017-09-04 20:21:16 +01:00
Pedro Alves 858be34c5a Handle "p S::method()::static_var" in the C++ parser
This commit makes "print S::method()::static_var" actually find the
debug symbol for static_var.  Currently, you get:

  (gdb) print S::method()::static_var
  A syntax error in expression, near `'.

Quoting the whole string would seemingly work before the previous
patch that made GDB stop assuming int for no-debug-info variables:

  (gdb) p 'S::method()::static_var'
  $1 = 1

... except that's incorrect output, because:

  (gdb) ptype 'S::method()::static_var'
  type = <data variable, no debug info>

The way to make it work correctly currently is by quoting the
function/method part, like this:

  (gdb) print 'S::method()'::static_var
  $1 = {i1 = 1, i2 = 2, i3 = 3}
  (gdb) ptype 'S::method()'::static_var
  type = struct aggregate {
      int i1;
      int i2;
      int i3;
  }

At least after the "stop assuming int" patch, this is what we
now get:

  (gdb) p 'S::method()::static_var'
  'S::method()::static_var' has unknown type; cast it to its declared type
  (gdb) p (struct aggregate) 'S::method()::static_var'
  $1 = {i1 = 1, i2 = 2, i3 = 3}

However, IMO, users shouldn't really have to care about any of this.
GDB should Just Work, without quoting, IMO.

So here's a patch that implements support for that in the C++ parser.
With this patch, you now get:

  (gdb) p S::method()::S_M_s_var_aggregate
  $1 = {i1 = 1, i2 = 2, i3 = 3}
  (gdb) ptype S::method()::S_M_s_var_aggregate
  type = struct aggregate {
      int i1;
      int i2;
      int i3;
  }

gdb/ChangeLog:
2017-09-04  Pedro Alves  <palves@redhat.com>

	(%type <voidval>): Add function_method.
	* c-exp.y (exp): New production for calls with no arguments.
	(function_method, function_method_void_or_typelist): New
	productions.
	(exp): New production for "method()::static_var".
	* eval.c (evaluate_subexp_standard): Handle OP_FUNC_STATIC_VAR.
	* expprint.c (print_subexp_standard, dump_subexp_body_standard):
	Handle OP_FUNC_STATIC_VAR.
	* parse.c (operator_length_standard):
	Handle OP_FUNC_STATIC_VAR.
	* std-operator.def (OP_FUNC_STATIC_VAR): New.

gdb/testsuite/ChangeLog:
2017-09-04  Pedro Alves  <palves@redhat.com>

	* gdb.base/local-static.c: New.
	* gdb.base/local-static.cc: New.
	* gdb.base/local-static.exp:  New.
2017-09-04 20:21:15 +01:00
Pedro Alves dd5901a6a5 Eliminate UNOP_MEMVAL_TLS
Since minsym references now go via OP_VAR_MSYM_VALUE, UNOP_MEMVAL_TLS
is no longer used anywhere.

gdb/ChangeLog:
2017-09-04  Pedro Alves  <palves@redhat.com>

	* eval.c (evaluate_subexp_standard): Remove UNOP_MEMVAL_TLS
	handling.
	* expprint.c (print_subexp_standard, dump_subexp_body_standard):
	Ditto.
	* parse.c (operator_length_standard, operator_check_standard):
	Ditto.
	* std-operator.def (UNOP_MEMVAL_TLS): Delete.
2017-09-04 20:21:15 +01:00
Pedro Alves 74ea4be48e Introduce OP_VAR_MSYM_VALUE
The previous patch left GDB with an inconsistency.  While with normal
expression evaluation the "unknown return type" error shows the name
of the function that misses debug info:

  (gdb) p getenv ("PATH")
  'getenv' has unknown return type; cast the call to its declared return type
   ^^^^^^

which can by handy in more complicated expressions, "ptype" does not:

  (gdb) ptype getenv ("PATH")
  function has unknown return type; cast the call to its declared return type
  ^^^^^^^^

This commit is a step toward fixing it.

The problem is that while evaluating the expression above, we have no
reference to the minimal symbol where we could extract the name from.
This is because the resulting expression tree has no reference to the
minsym at all.  During parsing, the type and address of the minsym are
extracted and an UNOP_MEMVAL / UNOP_MEMVAL_TLS operator is generated
(see write_exp_elt_msym).  With "set debug expression", here's what
you see:

            0  OP_FUNCALL            Number of args: 0
            3    UNOP_MEMVAL           Type @0x565334a51930 (<text variable, no debug info>)
            6      OP_LONG               Type @0x565334a51c60 (__CORE_ADDR), value 140737345035648 (0x7ffff7751d80)

The "print" case finds the function name, because
call_function_by_hand looks up the function by address again.
However, for "ptype", we don't reach that code, because obviously we
don't really call the function.

Unlike minsym references, references to variables with debug info have
a pointer to the variable's symbol in the expression tree, with
OP_VAR_VALUE:

  (gdb) ptype main()
  ...
            0  OP_FUNCALL            Number of args: 0
            3    OP_VAR_VALUE          Block @0x0, symbol @0x559bbbd9b358 (main(int, char**))
  ...

so I don't see why do minsyms need to be different.  So to prepare for
fixing the missing function name issue, this commit adds a new
OP_VAR_MSYM_VALUE operator that mimics OP_VAR_VALUE, except that it's
for minsyms instead of debug symbols.  For infcalls, we now get
expressions like these:

            0  OP_FUNCALL            Number of args: 0
            3    OP_VAR_MSYM_VALUE     Objfile @0x1e41bf0, msymbol @0x7fffe599b000 (getenv)

In the following patch, we'll make OP_FUNCALL extract the function
name from the symbol stored in OP_VAR_VALUE/OP_VAR_MSYM_VALUE.

OP_VAR_MSYM_VALUE will be used more in a later patch in the series
too.

gdb/ChangeLog:
2017-09-04  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (resolve_subexp): Handle OP_VAR_MSYM_VALUE.
	* ax-gdb.c (gen_msym_var_ref): New function.
	(gen_expr): Handle OP_VAR_MSYM_VALUE.
	* eval.c (evaluate_var_msym_value): New function.
	* eval.c (evaluate_subexp_standard): Handle OP_VAR_MSYM_VALUE.
	<OP_FUNCALL>: Extract function name from symbol/minsym and pass it
	to call_function_by_hand.
	* expprint.c (print_subexp_standard, dump_subexp_body_standard):
	Handle OP_VAR_MSYM_VALUE.
	(union exp_element) <msymbol>: New field.
	* minsyms.h (struct type): Forward declare.
	(find_minsym_type_and_address): Declare.
	* parse.c (write_exp_elt_msym): New function.
	(write_exp_msymbol): Delete, refactored as ...
	(find_minsym_type_and_address): ... this new function.
	(write_exp_msymbol): Reimplement using OP_VAR_MSYM_VALUE.
	(operator_length_standard, operator_check_standard): Handle
	OP_VAR_MSYM_VALUE.
	* std-operator.def (OP_VAR_MSYM_VALUE): New.
2017-09-04 20:21:13 +01:00
Jan Kratochvil 216f72a1ed DWARF-5: call sites
this patch updates all call sites related DWARF-5 renames.

gdb/ChangeLog
2017-02-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* block.c (call_site_for_pc): Rename DW_OP_GNU_*, DW_TAG_GNU_* and
	DW_AT_GNU_*.
	* common/common-exceptions.h (enum errors): Likewise.
	* dwarf2-frame.c (class dwarf_expr_executor): Likewise.
	* dwarf2expr.c (dwarf_block_to_dwarf_reg)
	(dwarf_expr_context::execute_stack_op): Likewise.
	* dwarf2expr.h (struct dwarf_expr_context, struct dwarf_expr_piece):
	Likewise.
	* dwarf2loc.c (dwarf_evaluate_loc_desc::get_base_type)
	(dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value)
	(show_entry_values_debug, call_site_to_target_addr)
	(func_addr_to_tail_call_list, func_verify_no_selftailcall)
	(dwarf_expr_reg_to_entry_parameter, dwarf_entry_parameter_to_value)
	(entry_data_value_free_closure, value_of_dwarf_reg_entry)
	(value_of_dwarf_block_entry, indirect_pieced_value)
	(symbol_needs_eval_context::push_dwarf_reg_entry_value):
	(disassemble_dwarf_expression): Likewise.
	* dwarf2read.c (process_die, inherit_abstract_dies)
	(read_call_site_scope): Likewise.
	* gdbtypes.h (struct func_type, struct call_site_parameter)
	(struct call_site): Likewise.
	* stack.c (read_frame_arg): Likewise.
	* std-operator.def (OP_VAR_ENTRY_VALUE): Likewise.

gdb/doc/ChangeLog
2017-02-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.texinfo (Print Settings, Tail Call Frames): Rename DW_OP_GNU_*,
	DW_TAG_GNU_* and DW_AT_GNU_*.

gdb/testsuite/ChangeLog
2017-02-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.arch/amd64-entry-value-param-dwarf5.S: New file.
	* gdb.arch/amd64-entry-value-param-dwarf5.c: New file.
	* gdb.arch/amd64-entry-value-param-dwarf5.exp: New file.
	* gdb.arch/amd64-entry-value.exp: Rename DW_OP_GNU_*, DW_TAG_GNU_* and
	DW_AT_GNU_*.
2017-02-20 21:00:55 +01:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Tom Tromey 01739a3b6a Rename OP_F90_RANGE to OP_RANGE.
This renames OP_F90_RANGE to OP_RANGE, and similarly renames the
f90_range_type enum.

2016-05-17  Tom Tromey  <tom@tromey.com>

	* std-operator.def (OP_RANGE): Rename from OP_F90_RANGE.
	* rust-lang.c: Don't include f-lang.h.
	(rust_range, rust_compute_range, rust_subscript)
	(rust_evaluate_subexp): Update.
	* rust-exp.y: Don't include f-lang.h.
	(ast_range, convert_ast_to_expression): Update.
	* parse.c (operator_length_standard): Update.
	* f-lang.h (enum f90_range_type): Move to expression.h.
	* f-exp.y: Use OP_RANGE.
	* expression.h (enum range_type): New enum; renamed from
	f90_range_type.
	* expprint.c: Don't include f-lang.h.
	(print_subexp_standard, dump_subexp_body_standard): Use OP_RANGE.
	* eval.c (value_f90_subarray, evaluate_subexp_standard): Update.
2016-05-17 12:02:03 -06:00
Tom Tromey c44af4ebc0 Add support for the Rust language
This patch adds support for the Rust language.

2016-05-17  Tom Tromey  <tom@tromey.com>
	    Manish Goregaokar <manishsmail@gmail.com>

	* symtab.c (symbol_find_demangled_name): Handle Rust.
	* symfile.c (init_filename_language_table): Treat ".rs" as Rust.
	* std-operator.def (STRUCTOP_ANONYMOUS, OP_RUST_ARRAY): New
	constants.
	* rust-lang.h: New file.
	* rust-lang.c: New file.
	* rust-exp.y: New file.
	* dwarf2read.c (read_file_scope): Add Rust producer sniffing.
	(dwarf2_compute_name, read_func_scope, read_structure_type)
	(read_base_type, read_subrange_type, set_cu_language)
	(new_symbol_full, determine_prefix): Handle Rust.
	* defs.h (enum language) <language_rust>: New constant.
	* Makefile.in (SFILES): Add rust-exp.y, rust-lang.c.
	(COMMON_OBS): Add rust-exp.o, rust-lang.o.

2016-05-17  Tom Tromey  <tom@tromey.com>

	* gdb.base/default.exp (set language): Add rust.
2016-05-17 12:02:00 -06:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Yao Qi c9402c9579 Update comments to TERNOP_SLICE
TERNOP_SLICE was added for language Chill, but it is used for Ada and D later.
Since language Chill was removed from GDB, TERNOP_SLICE is only used for
Ada and D.  This patch is to update its comments.

gdb:

2014-07-20  Yao Qi  <yao@codesourcery.com>

	* std-operator.def: Update comments to TERNOP_SLICE.
2014-07-21 03:46:43 +08:00
Yao Qi ae8fddda32 Remove operator BINOP_RANGE
BINOP_RANGE was added by the following commit for chill language.

commit badefd2800
Author: Per Bothner <per@bothner.com>
Date:   Wed Nov 29 22:59:31 1995 +0000

        * expression.h (enum exp_opcode):  Add BINOP_RANGE.
        * expprint.c (dump_expression):  Support BINOP_RANGE.
        * eval.c (evaluate_subexp_standard):  Handle BINOP_RANGE (as error).
        (case MULTI_SUBSCRIPT):  Fix broken f77 value->int ad hoc conversion.
        * ch-lang.c (chill_op_print_tab):  Support BINOP_RANGE.
        (evaluate_subexp_chill):  Error on BINOP_COMMA.

Chill language is no longer supported, so we can remove BINOP_RANGE too.
This patch is to remove BINOP_RANGE.

gdb:

2014-07-20  Yao Qi  <yao@codesourcery.com>

	* std-operator.def: Remove BINOP_RANGE.
	* breakpoint.c (watchpoint_exp_is_const): Update.
	* expprint.c (dump_subexp_body_standard): Likewise.
	* eval.c (init_array_element): Remove dead code.
	(evaluate_subexp_standard): Likewise.
2014-07-21 03:46:37 +08:00
Yao Qi 9c81664074 Remove operator BINOP_IN
Chill language support was removed several years ago, and BINOP_IN
isn't used for Pascal.  This patch is to remove BINOP_IN.

gdb:

2014-07-20  Yao Qi  <yao@codesourcery.com>

	* std-operator.def: Remove BINOP_IN.
	* breakpoint.c (watchpoint_exp_is_const): Update.
	* eval.c (evaluate_subexp_standard): Likewise.
	* expprint.c (dump_subexp_body_standard): Likewise.
2014-07-21 03:46:33 +08:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Tom Tromey 6e72ca205c PR c++/9065:
* NEWS: Update.
	* breakpoint.c (watchpoint_exp_is_const): Add OP_TYPEID.
	* c-exp.y (TYPEID): New token.
	(exp): Add new TYPEID productions.
	(ident_tokens): Add "typeid".
	* cp-abi.c (cplus_typeid, cplus_typeid_type): New functions.
	* cp-abi.h (cplus_typeid, cplus_typeid_type): Declare.
	(struct cp_abi_ops) <get_typeid, get_typeid_type>: New fields.
	* eval.c (evaluate_subexp_standard) <OP_TYPEID>: New case.
	* expprint.c (dump_subexp_body_standard) <OP_TYPEID>: New
	case.
	* gnu-v3-abi.c (std_type_info_gdbarch_data): New global.
	(build_std_type_info_type, gnuv3_get_typeid_type)
	(gnuv3_get_typeid): New functions.
	(init_gnuv3_ops): Initialize std_type_info_gdbarch_data.  Set
	new fields on ABI object.
	* parse.c (operator_length_standard) <OP_TYPEID>: New case.
	* std-operator.def (OP_TYPEID): New.
gdb/testsuite
	* gdb.cp/typeid.cc: New file.
	* gdb.cp/typeid.exp: New file.
2013-04-15 17:36:14 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Yao Qi f0559fff60 gdb:
2012-11-02  Yao Qi  <yao@codesourcery.com>

	* std-operator.def: Remove OP_LABELED.
	* eval.c: Remove the declaration of 'get_label'.
	(get_label): Remove.
	(evaluate_struct_tuple): Remove code handling OP_LABELED.
	Update comment.
	Remove local variable 'variantno' and related code.
	Replace 'substruct_type' with 'struct_type'.  Replace 'subfieldno'
	with 'fieldno'.
	* expprint.c (print_subexp_standard): Likewise.
	(dump_subexp_body_standard): Likewise.
	* parse.c (operator_length_standard): Likewise.

gdb/testsuite:

2012-11-02  Yao Qi  <yao@codesourcery.com>

	* gdb.base/setvar.exp: Test setting nested struct.
	* gdb.base/setvar.c (v_struct3): New.
2012-11-02 00:14:39 +00:00
Yao Qi 7507c54a53 gdb/
* std-operator.def: Remove TERNOP_SLICE_COUNT.
	* breakpoint.c (watchpoint_exp_is_const): Remove handling to
	TERNOP_SLICE_COUNT.
	* eval.c (evaluate_subexp_standard): Likewise.
	* expprint.c (print_subexp_standard): Likewise.
	(dump_subexp_body_standard): Likewise.
	* parse.c (operator_length_standard): Likewise.
2012-08-13 01:02:07 +00:00
Yao Qi 5cad973621 gdb/
* std-operator.def: Remove OP_BITSTRING.
	* breakpoint.c (watchpoint_exp_is_const): Update.
	* eval.c (evaluate_subexp_standard): Remove handling to
	OP_BITSTRING.
	* expprint.c (print_subexp_standard): Likewise.
	(dump_subexp_body_standard): Likewise.
	* parse.c (operator_length_standard): Likewise.
	* valops.c (value_bitstring): Remove.
	* value.h: Remove the declaration of 'value_bitstring'.
2012-08-13 00:54:04 +00:00
Tom Tromey 608b49672e PR exp/13206:
* ax-gdb.c (gen_expr) <OP_TYPEOF, OP_DECLTYPE>: New cases.
	* breakpoint.c (watchpoint_exp_is_const) <OP_TYPEOF,
	OP_DECLTYPE>: New cases.
	* c-exp.y (TYPEOF, DECLTYPE): New tokens.
	(type_exp): Add new productions.
	(ident_tokens): Add __typeof__, typeof, __typeof, __decltype,
	and decltype.
	* eval.c (evaluate_subexp_standard) <OP_TYPEOF, OP_DECLTYPE>:
	New case.
	* expprint.c (dump_subexp_body_standard) <OP_TYPEOF,
	OP_DECLTYPE>: New case.
	* parse.c (operator_length_standard) <OP_TYPEOF, OP_DECLTYPE>:
	New case.
	* std-operator.def (OP_TYPEOF, OP_DECLTYPE): New constants.
	* varobj.c (varobj_create): Handle OP_TYPEOF, OP_DECLTYPE.
gdb/testsuite
	* gdb.cp/casts.exp: Add tests for typeof and decltype.
	* gdb.cp/casts.cc (decltype): New function.
	(main): Use it.
2012-07-19 15:38:18 +00:00
Tom Tromey 9eaf670568 * ax-gdb.c (gen_expr): Handle UNOP_CAST_TYPE, UNOP_MEMVAL_TYPE.
* breakpoint.c (watchpoint_exp_is_const): Handle UNOP_CAST_TYPE,
	UNOP_REINTERPRET_CAST, UNOP_DYNAMIC_CAST.
	* c-exp.y (exp): Emit UNOP_MEMVAL_TYPE, UNOP_CAST_TYPE.  Update
	for changes to UNOP_REINTERPRET_CAST, UNOP_DYNAMIC_CAST.  Use
	type_exp production where appropriate.
	* eval.c (evaluate_subexp_standard) <UNOP_CAST_TYPE>: New case.
	<UNOP_DYNAMIC_CAST, UNOP_REINTERPRET_CAST>: Update.
	<UNOP_MEMVAL_TYPE>: New case.
	(evaluate_subexp_for_address) <UNOP_MEMVAL_TYPE>: New case.
	(evaluate_subexp_for_sizeof) <UNOP_MEMVAL_TYPE>: New case.
	* expprint.c (print_subexp_standard) <UNOP_CAST_TYPE>: New case.
	<UNOP_MEMVAL_TYPE>: New case.
	(dump_subexp_body_standard) <UNOP_DYNAMIC_CAST,
	UNOP_REINTERPRET_CAST>: Update.
	<UNOP_CAST_TYPE, UNOP_MEMVAL_TYPE>: New cases.
	* parse.c (operator_length_standard) <UNOP_DYNAMIC_CAST,
	UNOP_REINTERPRET_CAST>: Update.
	<UNOP_CAST_TYPE, UNOP_MEMVAL_TYPE>: New cases.
	* stack.c (return_command): Also check for UNOP_CAST_TYPE.
	* std-operator.def (UNOP_CAST_TYPE, UNOP_MEMVAL_TYPE): New
	constants.
2012-07-19 15:33:25 +00:00
Joel Brobecker 0b30217134 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:17:56 +00:00
Jan Kratochvil 36b11add17 gdb/
Support @entry in input expressions.
	* c-exp.y (ENTRY, unknown_cpp_name): New.
	(exp: UNKNOWN_CPP_NAME): Change to `exp: unknown_cpp_name'.
	(unknown_cpp_name: UNKNOWN_CPP_NAME, unknown_cpp_name: ENTRY)
	(variable: name_not_typename '@' ENTRY, name: ENTRY)
	(name_not_typename: ENTRY): New.
	(yylex): Recognize ENTRY.
	* eval.c (evaluate_subexp_standard): Support also OP_VAR_ENTRY_VALUE.
	* expprint.c (print_subexp_standard, dump_subexp_body_standard):
	Likewise.
	* parse.c (operator_length_standard): Likewise.
	* std-operator.def: New operator OP_VAR_ENTRY_VALUE.

gdb/doc/
	Support @entry in input expressions.
	* gdb.texinfo (Variables): Describe @entry names suffix.
	(Print Settings): Add anchor for `set print entry-values'.

gdb/testsuite/
	Support @entry in input expressions.
	* gdb.arch/amd64-entry-value.exp (entry: p i@entry, entry: p j@entry)
	(entry_stack: p s1@entry, entry_stack: p s2@entry)
	(entry_stack: p d9@entry, entry_stack: p da@entry, tailcall: p i@entry)
	(tailcall: p j@entry): New tests.
	* gdb.cp/koenig.cc (A::entry): New function.
	(main): Call it.
	* gdb.cp/koenig.exp (p entry (c)): New test.
2011-10-09 19:41:17 +00:00
Tom Tromey aee28ec61a * valops.c (value_of_local): Complain if NAME is NULL.
* std-operator.def (OP_OBJC_SELF): Remove.
	* parse.c (operator_length_standard) <OP_OBJC_SELF>: Remove.
	* objc-exp.y (name_not_typename): Use OP_THIS.
	* expprint.c (print_subexp_standard) <OP_THIS>: Print language's
	name for "this".
	<OP_OBJC_SELF>: Remove.
	* eval.c (evaluate_subexp_standard) <OP_OBJC_SELF>: Remove.
2011-06-17 20:24:22 +00:00
Jan Kratochvil 56c1241406 gdb/
Fix debug printing of BINOP_IN, OP_OBJC_MSGCALL,
	OP_F77_UNDETERMINED_ARGLIST, OP_COMPLEX, OP_OBJC_SELECTOR, OP_NAME,
	OP_OBJC_NSSTRING, OP_F90_RANGE and OP_DECFLOAT.
	* ada-operator.inc: Rename the file to ...
	* ada-operator.def: ... here, wrap all the entries by macro OP.
	* expprint.c (op_name_standard): Remove all the entries.  Include
	"std-operator.def" instead.
	* expression.h (enum exp_opcode): Include "std-operator.def" and
	"ada-operator.def".  Move all the entries ...
	* std-operator.def: ... here, wrap all the entries by macro OP.
2011-02-01 18:54:01 +00:00