This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
dynamic array's upper bound evaluated as address for AVR target
- From: "Sivanupandi, Pitchumani" <Pitchumani dot Sivanupandi at atmel dot com>
- To: "gdb at sourceware dot org" <gdb at sourceware dot org>
- Cc: Andrew Burgess <andrew dot burgess at embecosm dot com>, "tom at tromey dot com" <tom at tromey dot com>, "uweigand at de dot ibm dot com" <uweigand at de dot ibm dot com>
- Date: Tue, 13 Oct 2015 09:07:50 +0000
- Subject: dynamic array's upper bound evaluated as address for AVR target
- Authentication-results: sourceware.org; auth=none
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