This is the mail archive of the gdb-patches@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]

Re: Build failure with probe patch


    > Yes, but not the other way around...  it is not allowed to alias a
    > character type with a non-character type like in the following call to
    > dtrace_process_dof:
    
    Ah, right.
    
    > gdb_byte *buf;
    > [...]
    > dtrace_process_dof (sect, objfile, probesp, (struct dtrace_dof_hdr *) buf);
    
    Hmm, still, but I think this may be alright.
    
    gdb_bfd_map_section and bfd_get_full_section_contents return
    allocated objects, which have no declared type to begin with
    (C99 6.5/6, footnote 75).
    
    Then per C99 6.5/6, since the allocated object is never written
    through an lvalue with a type that is not a character type, then
    the effective type of the object is "simply the type of the
    lvalue used for the access."
    
    So it seems to me that casting to struct dtrace_dof_hdr * and then
    reading from that lvalue is OK: from that point on, the object
    pointed at by BUF has effective type struct dtrace_dof_hdr.

Good point!  Yes, I agree.  Both bfd_byte and gdb_byte are character
types, so the object returned by either bfd_malloc_and_get_section or
gdb_bfd_map_section must retain the property of not having a declared
type.


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