diff options
author | Sanimir Agovic <sanimir.agovic@intel.com> | 2013-10-09 15:28:22 +0100 |
---|---|---|
committer | Sanimir Agovic <sanimir.agovic@intel.com> | 2014-04-11 13:43:49 +0100 |
commit | 26cb189f8b46dbe7b2d485525329a8919005ca8a (patch) | |
tree | 8fe10666e55f41ae02a7e885fe3ba758dc4fd9bd /gdb/valops.c | |
parent | 37c1ab67a35025d37d42c449deab5f254f9f59da (diff) | |
download | gdb-26cb189f8b46dbe7b2d485525329a8919005ca8a.zip gdb-26cb189f8b46dbe7b2d485525329a8919005ca8a.tar.gz gdb-26cb189f8b46dbe7b2d485525329a8919005ca8a.tar.bz2 |
vla: enable sizeof operator to work with variable length arrays
In C99 the sizeof operator computes the size of a variable length array
at runtime (6.5.3.4 The sizeof operator). This patch reflects the semantic
change in the debugger.
We now are able to get the size of a vla:
1| void foo (size_t n) {
2| int vla[n];
3| }
(gdb) p sizeof(vla)
yields N * sizeof(int).
* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
passed to sizeof is dynamic evaluate the argument to compute the length.
Diffstat (limited to 'gdb/valops.c')
0 files changed, 0 insertions, 0 deletions