-var-create on typedef'ed array inside a structure fails

View: New views
2 Messages — Rating Filter:   Alert me  

-var-create on typedef'ed array inside a structure fails

by Harish Dewan-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

While using the below code


typedef long k[5];

typedef struct students {
    int a_rollNumber;   
    k array_variable;
} Students;

int main () {
      Students student;
      student.a_rollNumber = 3;
    return 0;
}

When I run the above code snippet in Debug mode (using gdb) and try to
click and expand the value of the “array_variable" variable,
the variable view crashes with an error message displayed in the view as
“Argument to arithmetic operation not a number or boolean"

I get this console message in gdb console:

[1,222,865,794,703] 577-var-create - * *(((student).array_variable)+0)@5

[1,222,865,794,703] &"Argument to arithmetic operation not a number or boolean.\n"

[1,222,865,794,703] 577^error,msg="Argument to arithmetic operation not a number or boolean."

[1,222,865,794,703] (gdb)

While searching from the mailing list I found a thread related to this
http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg09048.html

And a bug is filed for this kind of bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=118114

the only difference in the above filed bug and mine is that I am using typedef array inside structure

Can anyone else also reproduce this problem?
I am using eclipse 3.4 and cdt 5

Thanks in advance
Harish.
Tensilica Technologies India
Pune




Rediff Shopping

_______________________________________________
cdt-dev mailing list
cdt-dev@...
https://dev.eclipse.org/mailman/listinfo/cdt-dev

RE: -var-create on typedef'ed array inside a structure fails

by Marc Khouzam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I was able to reproduce the problem with GDB 6.8, and CDT 5.
 
127-var-create - * *(((student).array_variable)+0)@5

It is the +0 that causes the problem.
It seems GDB does not like to do pointer arithmetic on
student.array_variable
because it is of type 'k'.  If it was of type long[5], it would work.
This sounds like a special case to handle.

BTW, you can try it with DSF instead of CDI, this example did work with
DSF.

Marc

> -----Original Message-----
> From: cdt-dev-bounces@...
> [mailto:cdt-dev-bounces@...] On Behalf Of Harish Dewan
> Sent: Wednesday, October 01, 2008 9:12 AM
> To: cdt-dev@...
> Subject: [cdt-dev] -var-create on typedef'ed array inside a
> structure fails
>
> Hi all,
>
> While using the below code
>
>
> typedef long k[5];
>
> typedef struct students {
>     int a_rollNumber;    
>     k array_variable;
> } Students;
>
> int main () {
>       Students student;
>       student.a_rollNumber = 3;
>     return 0;
> }
>
> When I run the above code snippet in Debug mode (using gdb)
> and try to
> click and expand the value of the "array_variable" variable,
> the variable view crashes with an error message displayed in
> the view as
> "Argument to arithmetic operation not a number or boolean"
>
> I get this console message in gdb console:
>
> [1,222,865,794,703] 577-var-create - *
> *(((student).array_variable)+0)@5
>
> [1,222,865,794,703] &"Argument to arithmetic operation not a
> number or boolean.\n"
>
> [1,222,865,794,703] 577^error,msg="Argument to arithmetic
> operation not a number or boolean."
>
> [1,222,865,794,703] (gdb)
>
> While searching from the mailing list I found a thread
> related to this
> http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg09048.html
>
> And a bug is filed for this kind of bug
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=118114
>
> the only difference in the above filed bug and mine is that I
> am using typedef array inside structure
>
> Can anyone else also reproduce this problem?
> I am using eclipse 3.4 and cdt 5
>
> Thanks in advance
> Harish.
> Tensilica Technologies India
> Pune
>
>
>
>
>
>
> Rediff Shopping
> <http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.redif
> f.com/signature-default.htm/1050715198@Middle5/2206641_2199021
> /2201651/1?PARTNER=3&OAS_QUERY=null>
>
_______________________________________________
cdt-dev mailing list
cdt-dev@...
https://dev.eclipse.org/mailman/listinfo/cdt-dev
LightInTheBox - Buy quality products at wholesale price!