+2013-11-15 Joel Brobecker <brobecker@adacore.com>
+
+ * dwarf2expr.h (struct dwarf_expr_context_funcs) <read_reg>:
+ Extend the documentation a bit.
+ <get_reg_value>: New field.
+ * dwarf2loc.c (dwarf_expr_get_reg_value)
+ (needs_frame_get_reg_value): New functions.
+ (dwarf_expr_ctx_funcs, needs_frame_ctx_funcs): Add "get_reg_value"
+ callback.
+ * dwarf2-frame.c (get_reg_value): New function.
+ (dwarf2_frame_ctx_funcs): Add "get_reg_value" callback.
+ * dwarf2expr.c (execute_stack_op) <DW_OP_GNU_regval_type>:
+ Use new callback to compute result_val.
+
2013-11-15 Alan Modra <amodra@gmail.com>
* ppc64-tdep.c (ppc64_plt_entry_point): Renamed from..
return unpack_long (register_type (gdbarch, regnum), buf);
}
+/* Implement struct dwarf_expr_context_funcs' "get_reg_value" callback. */
+
+static struct value *
+get_reg_value (void *baton, struct type *type, int reg)
+{
+ struct frame_info *this_frame = (struct frame_info *) baton;
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+ int regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, reg);
+
+ return value_from_register (type, regnum, this_frame);
+}
+
static void
read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len)
{
static const struct dwarf_expr_context_funcs dwarf2_frame_ctx_funcs =
{
read_reg,
+ get_reg_value,
read_mem,
ctx_no_get_frame_base,
ctx_no_get_frame_cfa,
type_die.cu_off = uoffset;
type = dwarf_get_base_type (ctx, type_die, 0);
- result = (ctx->funcs->read_reg) (ctx->baton, reg);
- result_val = value_from_ulongest (address_type, result);
- result_val = value_from_contents (type,
- value_contents_all (result_val));
+ result_val = ctx->funcs->get_reg_value (ctx->baton, type, reg);
}
break;
struct dwarf_expr_context_funcs
{
- /* Return the value of register number REGNUM. */
+ /* Return the value of register number REGNUM (a DWARF register number),
+ read as an address. */
CORE_ADDR (*read_reg) (void *baton, int regnum);
+ /* Return a value of type TYPE, stored in register number REGNUM
+ of the frame associated to the given BATON.
+
+ REGNUM is a DWARF register number. */
+ struct value *(*get_reg_value) (void *baton, struct type *type, int regnum);
+
/* Read LENGTH bytes at ADDR into BUF. */
void (*read_mem) (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t length);
return result;
}
+/* Implement struct dwarf_expr_context_funcs' "get_reg_value" callback. */
+
+static struct value *
+dwarf_expr_get_reg_value (void *baton, struct type *type, int dwarf_regnum)
+{
+ struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+ struct gdbarch *gdbarch = get_frame_arch (debaton->frame);
+ int regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, dwarf_regnum);
+
+ return value_from_register (type, regnum, debaton->frame);
+}
+
/* Read memory at ADDR (length LEN) into BUF. */
static void
static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
{
dwarf_expr_read_reg,
+ dwarf_expr_get_reg_value,
dwarf_expr_read_mem,
dwarf_expr_frame_base,
dwarf_expr_frame_cfa,
return 1;
}
+/* struct dwarf_expr_context_funcs' "get_reg_value" callback:
+ Reads from registers do require a frame. */
+
+static struct value *
+needs_frame_get_reg_value (void *baton, struct type *type, int regnum)
+{
+ struct needs_frame_baton *nf_baton = baton;
+
+ nf_baton->needs_frame = 1;
+ return value_zero (type, not_lval);
+}
+
/* Reads from memory do not require a frame. */
static void
needs_frame_read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len)
static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs =
{
needs_frame_read_reg,
+ needs_frame_get_reg_value,
needs_frame_read_mem,
needs_frame_frame_base,
needs_frame_frame_cfa,
+2013-11-15 Joel Brobecker <brobecker@adacore.com>
+
+ * gdb.ada/O2_float_param: New testcase.
+
2013-11-14 Tom Tromey <tromey@redhat.com>
* Makefile.in (check-parallel): Print summary from gdb.sum.
--- /dev/null
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# 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
+# the Free Software Foundation; either version 3 of the License, or
+# (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
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+if { [skip_ada_tests] } { return -1 }
+
+standard_ada_testfile foo
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug optimize=-O2}] != ""} {
+ return -1
+}
+
+clean_restart ${testfile}
+
+runto "increment"
+
+gdb_test "frame" \
+ "#0\\s+callee\\.increment \\(val(=val@entry)?=99\\.0, msg=\\.\\.\\.\\).*"
--- /dev/null
+-- Copyright 2013 Free Software Foundation, Inc.
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (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
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with IO; use IO;
+
+package body Callee is
+ procedure Increment (Val : in out Float; Msg: String) is
+ begin
+ if Val > 200.0 then
+ Put_Line (Msg);
+ end if;
+ Val := Val + 1.0;
+ end Increment;
+end Callee;
--- /dev/null
+-- Copyright 2013 Free Software Foundation, Inc.
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (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
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package Callee is
+ procedure Increment (Val : in out Float; Msg : String);
+end Callee;
--- /dev/null
+-- Copyright 2013 Free Software Foundation, Inc.
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (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
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with IO; use IO;
+with Callee; use Callee;
+
+package body Caller is
+ procedure Verbose_Increment (Val : in out Float; Msg : String) is
+ begin
+ Put_Line ("DEBUG: " & Msg);
+ Increment (Val, "Verbose_Increment");
+ end Verbose_Increment;
+end Caller;
+
--- /dev/null
+-- Copyright 2013 Free Software Foundation, Inc.
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (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
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package Caller is
+ procedure Verbose_Increment (Val : in out Float; Msg : String);
+end Caller;
+
--- /dev/null
+-- Copyright 2013 Free Software Foundation, Inc.
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (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
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with Caller; use Caller;
+
+procedure Foo is
+ Num : Float := 99.0;
+begin
+ Verbose_Increment (Num, "Foo");
+end Foo;
--- /dev/null
+-- Copyright 2013 Free Software Foundation, Inc.
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (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
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package body IO is
+ procedure Put_Line (S : String) is
+ begin
+ null;
+ end Put_Line;
+end IO;
--- /dev/null
+-- Copyright 2013 Free Software Foundation, Inc.
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (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
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package IO is
+ procedure Put_Line (S : String);
+end IO;