[Bug gdb/31851] GDB ignores absolute function symbols

marian.buschsieweke at posteo dot net sourceware-bugzilla@sourceware.org
Tue Jun 11 21:45:37 GMT 2024


https://sourceware.org/bugzilla/show_bug.cgi?id=31851

--- Comment #4 from Marian Buschsieweke <marian.buschsieweke at posteo dot net> ---
Note: I extended the test application a bit:


main.c:

    #include <stdio.h>

    extern void func(void);
    extern int data;
    extern int bss;

    int main(void)
    {
        volatile int *p;
        func();
        printf("data = %d, bss = %d\n", data, bss);
        p = &data;
        *p = 1;
        p = &bss;
        *p = 2;
        printf("data = %d, bss = %d\n", data, bss);
        return 0;
    }


func.c:

    #include <stdio.h>

    void func_impl(void)
    {
        puts("Hello from func");
    }

data.c:

    int data_impl = 42;
    int bss_impl = 0;

additions to the linker script:

    PROVIDE(func = ABSOLUTE(func_impl));
    /* ... */
    PROVIDE(data = ABSOLUTE(data_impl));
    /* ... */
    PROVIDE(bss = ABSOLUTE(bss_impl));

With the above patch applied, the symbol "func" was correctly identified as a
function, "bss" as .bss, and "data" as .data. I could successfully attach a
break point to "func" and watch points to "data" and "bss", and they triggered
as expected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list