Re: How to implement '@' GDB-like operator for libcc1

2015-03-21 Thread Jan Kratochvil
On Mon, 16 Mar 2015 15:43:21 +0100, Tom Tromey wrote: > It seems like there should be some kind of reference to &op0, that is, > lowering ATSIGN_EXPR to *(typeof(OP0)[OP1]*)(&OP0). OK, I got it now. I was using GDB-like 'struct type *' where 'struct value *' should have been as in GCC both are 't

Re: How to implement '@' GDB-like operator for libcc1

2015-03-16 Thread Tom Tromey
> "Jan" == Jan Kratochvil writes: Jan> I have problems implementing '@' into GCC, could you suggest at which place Jan> should I call build_array_type_nelts()? Or is it the right way at all? Jan> +case ATSIGN_EXPR: Jan> + orig_op0 = op0 = TREE_OPERAND (expr, 0); Jan> + orig_op

Re: How to implement '@' GDB-like operator for libcc1

2015-03-16 Thread Manuel López-Ibáñez
On 16 March 2015 at 10:58, Jan Kratochvil wrote: > If it is really difficult to implement '@' in GCC then yes, that's the other > way. I expected to learn GCC parser on this IMO-simpler case so one can later > implement for example the '{TYPE} ADDR' GDB extension, dropping C++ class > protections

Re: How to implement '@' GDB-like operator for libcc1

2015-03-16 Thread Jonathan Wakely
On 16 March 2015 at 09:58, Jan Kratochvil wrote: > I expected to learn GCC parser on this IMO-simpler case so one can later > implement for example the '{TYPE} ADDR' GDB extension, dropping C++ class > protections, There's the -fno-access-control flag to disable access checking, so I would have ex

Re: How to implement '@' GDB-like operator for libcc1

2015-03-16 Thread Jan Kratochvil
On Mon, 16 Mar 2015 10:33:26 +0100, Manuel López-Ibáñez wrote: > On 16 March 2015 at 09:32, Jan Kratochvil wrote: > > On Mon, 16 Mar 2015 04:22:35 +0100, Manuel López-Ibáñez wrote: > >> Thus, the question is what info GDB needs from GCC to be able to print > >> the contents of the array. > > > > V

Re: How to implement '@' GDB-like operator for libcc1

2015-03-16 Thread Manuel López-Ibáñez
On 16 March 2015 at 09:32, Jan Kratochvil wrote: > On Mon, 16 Mar 2015 04:22:35 +0100, Manuel López-Ibáñez wrote: >> Thus, the question is what info GDB needs from GCC to be able to print >> the contents of the array. > > Variable with an array type in DWARF. How does it work then for pointers?

Re: How to implement '@' GDB-like operator for libcc1

2015-03-16 Thread Jan Kratochvil
On Mon, 16 Mar 2015 04:22:35 +0100, Manuel López-Ibáñez wrote: > > > > But GDB features a useful custom expression operator '@': > > https://sourceware.org/gdb/onlinedocs/gdb/Arrays.html > > > > I have problems implementing '@' into GCC, could you suggest at which place > > should I call build_

Re: How to implement '@' GDB-like operator for libcc1

2015-03-15 Thread Manuel López-Ibáñez
> > But GDB features a useful custom expression operator '@': > https://sourceware.org/gdb/onlinedocs/gdb/Arrays.html > > I have problems implementing '@' into GCC, could you suggest at which place > should I call build_array_type_nelts()? Or is it the right way at all? > > Testing it on a sam