Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GDB]: gdb can't load up simple test case with usage of altivec vector bringing internal error. #30

Open
kas1e opened this issue Sep 19, 2024 · 1 comment

Comments

@kas1e
Copy link

kas1e commented Sep 19, 2024

There very simple test case:

#include <stdio.h>
#include <altivec.h>

void add_vectors(vector signed int* a, vector signed int* b, vector signed int* result) {
   // *result = vec_add(*a, *b);
}

int main() {
    return 0;
}

Compile it like:

ppc-amigaos-gcc -maltivec -gstabs test_vector.c -o test_vector

Once we tried to run it in GDB (that one Pegasos2 of course, with real Altivec in) , GDB bring this warning:

../../gdb/gdbtypes.c:939: internal-error: create_range_type: Assertion 'index_type->length () > 0` failed.
A problem internal to GDB has been detected.
futher debugging may prove unrelable.
Unable to dump core
@migthymax
Copy link
Member

I tried to track it down. The reason why it fails is that gdb has trouble reading the gstab debug information for the array )A vector is I think internally handled as an array by the compiler).

Dumping the gstab .section gives the following information

> objdump -G  test_vector
 
test_vector:     file format elf32-powerpc
 
Contents of .stab section:
 
Symnum n_type n_othr n_desc n_value  n_strx String
 
-1     HdrSym 0      15     000000b2 1     
 0      SO     0      2      010004c0 1      test_vector.c
 1      OPT    0      0      00000000 15     gcc2_compiled.
 2      FUN    0      0      010004c0 30     add_vectors:F(0,1)=(0,1)
 3      LSYM   0      0      00000000 55     void:t(0,1)
 4      PSYM   0      0      00000008 67     a:p(0,2)=*(0,3)=ar(0,0);0;3;(0,4)=r(0,4);-2147483648;2147483647;
 5      PSYM   0      0      0000000c 132    b:p(0,2)
 6      PSYM   0      0      00000010 141    result:p(0,2)
 7      LSYM   0      0      00000000 155    int:t(0,4)
 8      SLINE  0      4      00000000 0      
 9      SLINE  0      6      00000018 0      
 10     FUN    0      0      010004ec 166    main:F(0,4)
 11     SLINE  0      8      00000000 0      
 12     SLINE  0      9      0000000c 0      
 13     SLINE  0      10     00000010 0      
 14     SO     0      0      01000510 0      

This line makes the trouble:

...
 4      PSYM   0      0      00000008 67     a:p(0,2)=*(0,3)=ar(0,0);0;3;(0,4)=r(0,4);-2147483648;2147483647;
...

The question which arise is, if this is a general gdb bug, or specific because of my port. The later I don't think so, because I don't know how to influence the parsing of gstab. But it even might be that the gcc is producing buggy gstab information.

So if you have or know someone with a linux installation on a PowerPC with an altivec engines, which could verify if it works under linux or fails, would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants