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. 45326f6fbe28ef5bac22dac447a4181c44cb945a


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  45326f6fbe28ef5bac22dac447a4181c44cb945a (commit)
      from  e214cf6c2e05bcfc85dc6f335d8ffdc3629cf0cf (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=45326f6fbe28ef5bac22dac447a4181c44cb945a

commit 45326f6fbe28ef5bac22dac447a4181c44cb945a
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Jul 22 22:15:27 2014 +0200

    Remove setting value address for reference entry value target data value.
    
    I cannot reproduce any wrong case having the code removed.
    
    I just do not find it correct to have it disabled.  But at the same time I do
    like much / I do not find correct the code myself.  It is a bit problematic to
    have struct value describing a memory content which is no longer present
    there.
    
    What happens there:
    ------------------------------------------------------------------------------
    volatile int vv;
    static __attribute__((noinline)) int
    bar (int &ref) {
      ref = 20;
      vv++; /* break-here */
      return ref;
    }
    int main (void) {
      int var = 10;
      return bar (var);
    }
    ------------------------------------------------------------------------------
     <4><c7>: Abbrev Number: 13 (DW_TAG_GNU_call_site_parameter)
        <c8>   DW_AT_location    : 1 byte block: 55         (DW_OP_reg5 (rdi))
        <ca>   DW_AT_GNU_call_site_value: 2 byte block: 91 74       (DW_OP_fbreg: -12)
        <cd>   DW_AT_GNU_call_site_data_value: 1 byte block: 3a     (DW_OP_lit10)
    ------------------------------------------------------------------------------
    gdb -ex 'b value_addr' -ex r --args ../gdb ./1 -ex 'watch vv' -ex r -ex 'p &ref@entry'
    ->
    6    return ref;
    bar (ref=@0x7fffffffd944: 20, ref@entry=@0x7fffffffd944: 10) at 1.C:25
    ------------------------------------------------------------------------------
    At /* break-here */ struct value variable 'ref' is TYPE_CODE_REF.
    
    With FSF GDB HEAD:
    (gdb) x/gx arg1.contents
    0x6004000a4ad0: 0x00007fffffffd944
    (gdb) p ((struct value *)arg1.location.computed.closure).lval
    $1 = lval_memory
    (gdb) p/x ((struct value *)arg1.location.computed.closure).location.address
    $3 = 0x7fffffffd944
    
    With your #if0-ed code:
    (gdb) x/gx arg1.contents
    0x6004000a4ad0: 0x00007fffffffd944
    (gdb) p ((struct value *)arg1.location.computed.closure).lval
    $8 = not_lval
    (gdb) p/x ((struct value *)arg1.location.computed.closure).location.address
    $9 = 0x0
    
    I do not see how to access
            ((struct value *)arg1.location.computed.closure).location.address
    from GDB CLI.  Trying
    (gdb) p &ref@entry
    will invoke value_addr()'s:
      if (TYPE_CODE (type) == TYPE_CODE_REF)
          /* Copy the value, but change the type from (T&) to (T*).  We
             keep the same location information, which is efficient, and
             allows &(&X) to get the location containing the reference.  */
    and therefore the address gets fetched already from
      arg1.contents
    and not from
      ((struct value *)arg1.location.computed.closure).location.address
    .
    
    And for any other type than TYPE_CODE_REF this code you removed does not get
    executed at all.  This DW_AT_GNU_call_site_data_value DWARF was meant
    primarily for Fortran but with -O0 entry values do not get produced
    and with -Og and higher Fortran always optimizes out the passing by reference.
    
    If you do not like the removed code there I am OK with removing it as I do not
    know how to make it's use reproducible for user anyway.  In the worst case
    - if there really is some way how to exploit it - one should just get
      Attempt to take address of value not located in memory.
    instead of some wrong value and it may be easy to fix then.
    
    gdb/
    2014-07-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* dwarf2loc.c (value_of_dwarf_reg_entry): Remove setting value address
    	for reference entry value target data value.
    
    Message-ID: <20140720150727.GA18488@host2.jankratochvil.net>

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

Summary of changes:
 gdb/ChangeLog   |    5 +++++
 gdb/dwarf2loc.c |    9 ---------
 2 files changed, 5 insertions(+), 9 deletions(-)


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]