This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb and binutils branch master updated. 0acf8b658c00c8a3cc922c69a2d7277cb5f1a572


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  0acf8b658c00c8a3cc922c69a2d7277cb5f1a572 (commit)
      from  9055360d4a69313949c3535ec065080cb814367d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0acf8b658c00c8a3cc922c69a2d7277cb5f1a572

commit 0acf8b658c00c8a3cc922c69a2d7277cb5f1a572
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Thu Oct 31 01:36:21 2013 -0400

    Fix DW_OP_GNU_regval_type with FP registers
    
    Consider the following code, compiled at -O2 on ppc-linux:
    
        procedure Increment (Val : in out Float; Msg : String);
    
    The implementation does not really matter in this case). In our example,
    this function is being called from a function with Param_1 set to 99.0.
    Trying to break inside that function, and running until reaching that
    breakpoint yields:
    
        (gdb) b increment
        Breakpoint 1 at 0x100014b4: file callee.adb, line 6.
        (gdb) run
        Starting program: /[...]/foo
    
        Breakpoint 1, callee.increment (val=99.0, val@entry=0.0, msg=...)
            at callee.adb:6
        6             if Val > 200.0 then
    
    The @entry value for parameter "val" is incorrect, it should be 99.0.
    
    The associated call-site parameter DIE looks like this:
    
            .uleb128 0xc     # (DIE (0x115) DW_TAG_GNU_call_site_parameter)
            .byte   0x2      # DW_AT_location
            .byte   0x90     # DW_OP_regx
            .uleb128 0x21
            .byte   0x3      # DW_AT_GNU_call_site_value
            .byte   0xf5     # DW_OP_GNU_regval_type
            .uleb128 0x3f
            .uleb128 0x25
    
    The DW_AT_GNU_call_site_value uses a DW_OP_GNU_regval_type
    operation, referencing register 0x3f=63, which is $f31,
    an 8-byte floating register. In that register, the value is
    stored using the usual 8-byte float format:
    
        (gdb) info float
        f31            99.0 (raw 0x4058c00000000000)
    
    The current code evaluating DW_OP_GNU_regval_type operations
    currently is (dwarf2expr.c:execute_stack_op):
    
                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));
    
    What the ctx->funcs->read_reg function does is read the contents
    of the register as if it contained an address. The rest of the code
    continues that assumption, thinking it's OK to then use that to
    create an address/ulongest struct value, which we then re-type
    to the type specified by DW_OP_GNU_regval_type.
    
    We're getting 0.0 above because the read_reg implementations
    end up treating the contents of the FP register as an integral,
    reading only 4 out of the 8 bytes. Being a big-endian target,
    we read the high-order ones, which gives us zero.
    
    This patch fixes the problem by introducing a new callback to
    read the contents of a register as a given type, and then adjust
    the handling of DW_OP_GNU_regval_type to use that new callback.
    
    gdb/ChangeLog:
    
            * 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.
    
    gdb/testsuite/ChangeLog:
    
            * gdb.ada/O2_float_param: New testcase.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                                   |   14 ++++++++++
 gdb/dwarf2-frame.c                              |   13 +++++++++
 gdb/dwarf2expr.c                                |    5 +---
 gdb/dwarf2expr.h                                |    9 ++++++-
 gdb/dwarf2loc.c                                 |   26 +++++++++++++++++++
 gdb/testsuite/ChangeLog                         |    4 +++
 gdb/testsuite/gdb.ada/O2_float_param.exp        |   31 +++++++++++++++++++++++
 gdb/testsuite/gdb.ada/O2_float_param/callee.adb |   26 +++++++++++++++++++
 gdb/testsuite/gdb.ada/O2_float_param/callee.ads |   18 +++++++++++++
 gdb/testsuite/gdb.ada/O2_float_param/caller.adb |   26 +++++++++++++++++++
 gdb/testsuite/gdb.ada/O2_float_param/caller.ads |   19 ++++++++++++++
 gdb/testsuite/gdb.ada/O2_float_param/foo.adb    |   22 ++++++++++++++++
 gdb/testsuite/gdb.ada/O2_float_param/io.adb     |   21 +++++++++++++++
 gdb/testsuite/gdb.ada/O2_float_param/io.ads     |   18 +++++++++++++
 14 files changed, 247 insertions(+), 5 deletions(-)
 create mode 100644 gdb/testsuite/gdb.ada/O2_float_param.exp
 create mode 100644 gdb/testsuite/gdb.ada/O2_float_param/callee.adb
 create mode 100644 gdb/testsuite/gdb.ada/O2_float_param/callee.ads
 create mode 100644 gdb/testsuite/gdb.ada/O2_float_param/caller.adb
 create mode 100644 gdb/testsuite/gdb.ada/O2_float_param/caller.ads
 create mode 100644 gdb/testsuite/gdb.ada/O2_float_param/foo.adb
 create mode 100644 gdb/testsuite/gdb.ada/O2_float_param/io.adb
 create mode 100644 gdb/testsuite/gdb.ada/O2_float_param/io.ads


hooks/post-receive
-- 
gdb and binutils


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]