Mailing List Archive

[Bug 2921] fix compilation --with-ssl-engine

Ahmed Sayeed <> changed:

What |Removed |Added
CC| |

--- Comment #5 from Ahmed Sayeed <> ---
$ cat test.c
struct foo {
int len;
int items[];

struct foo *p;
int main() {
return 0;
$ gcc test.c -g -O0 -o test
$ ./gdb -q -nx --data-directory=data-directory ./test -ex
'python gdb.parse_and_eval("p")["items"].type.range()'
Reading symbols from ./test...
internal-error: LONGEST dynamic_prop::const_val() const: Assertion
`m_kind == PROP_CONST' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

This is because the Python code (typy_range) blindly reads the high
bound of the type of `items` as a constant value. Since it is a
flexible array member, it has no high bound, the property is
Since commit 8c2e4e0689 ("gdb: add accessors to
struct dynamic_prop"),
the getters check that you are not getting a property value of the
kind, so this causes a failed assertion.

Fix it by checking if the property is indeed a constant value
accessing it as such. Otherwise, use 0. This restores the
previous GDB
behavior: because the structure was zero-initialized, this is what was
returned before. But now this behavior is explicit and not
Add a test, gdb.python/flexible-array-member.exp, that is derived
gdb.base/flexible-array-member.exp. It tests the same things,
through the Python API. It also specifically tests getting the
from the various kinds of flexible array
member types (AFAIK it wasn't
possible to do the equivalent through the CLI).


You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
openssh-bugs mailing list