dynamic array's upper bound evaluated as address for AVR target

"Sivanupandi, Pitchumani" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAC140656783604CABA6AE60C2A6D5A4A2ED0DE4@penmbx01>
Tests from gdb.base/vla-datatypes.exp are failed for AVR target.
Test vla-datatypes.c validates size and values of dynamic arrays.

When evaluating the array expression (e.g. print int_vla), debug info for
upper bound of array read as location expression. By default, the location
expressions are treated as DWARF_VALUE_MEMORY (dwarf2expr.c:execute_stack_op).
and converted to target address (dwarf2loc.c:dwarf2_locexpr_baton_eval).

This will lead to incorrect upper bound value for targets like AVR where 
integer_to_address hook defined. For array 'int_vla', upper bound (e.g. 4)
is wrongly converted to avr target sram address (0x80004). And gdb tries to
read 0x100008 (0x80004 * 2) bytes of values from array's start address.
This is incorrect and caused timeout for avr target.

Why is that location expression treated as DWARF_VALUE_MEMORY by default?
Can gdb detect if location expression for literal value (e.g. array bounds)
or not?

Regards,
Pitchumani
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.