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: [testsuite patchv2] [ppc64] gdb_target_symbol fix for function descriptors [Re: [testsuite patch] [ppc64] +kfail: gdb_target


Yao Qi wrote:
> I am not sure what is the best approach of detecting function descriptor, so
> I copy Ulrich.
> 
> I suspect we should check whether the program is compiled with ELFv1,
> in which function descriptor is used.  So probably, we need to check
> __powerpc64__ and (!defined(_CALL_ELF) || _CALL_ELF !=3D 2) instead.

Well, most of the gdb.dwarf2 test cases simply use explicitly placed labels
for the DW_AT_low_pc / DW_AT_high_pc attributes.

See e.g. dw2-unresolved-main.c:

asm (".globl cu_text_start");
asm ("cu_text_start:");

int
main (void)
{
[...]
}

asm (".globl cu_text_end");
asm ("cu_text_end:");

and then in dw2-unresolved.S:

        /* main */
        .uleb128        3                       /* Abbrev: DW_TAG_subprogram */
        .byte           1                       /* DW_AT_decl_file */
        .byte           2                       /* DW_AT_decl_line */
        .ascii          "main\0"                /* DW_AT_name */
        .4byte          .Ltype_uchar-.Lcu1_begin        /* DW_AT_type */
        .4byte          cu_text_start           /* DW_AT_low_pc */
        .4byte          cu_text_end             /* DW_AT_high_pc */

This is a bit of a hack, but should simply work on both architectures
with and without function descriptors.  (Also, it actually gives you
something to use for DW_AT_high_pc as well, which would be hard to
come by otherwise in any case.)

If for some reason you want to check programmatically for presence of
function descriptors, then I agree that the __powerpc64__ ELFv1 ABI
check as you mention above is the correct way to do that.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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