diff options
author | Paul Marechal <paul.marechal@ericsson.com> | 2018-12-21 12:02:33 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-12-21 13:04:43 -0500 |
commit | d00a27c5addfb6b7350a39215b48f4aaffa5960c (patch) | |
tree | 903bfeed83cd1a7e8abefc60facf29e8648bd3b8 /gas/symbols.c | |
parent | 50c7c5b8df15aad66a9d2f6759e85689a2a74271 (diff) | |
download | gdb-d00a27c5addfb6b7350a39215b48f4aaffa5960c.zip gdb-d00a27c5addfb6b7350a39215b48f4aaffa5960c.tar.gz gdb-d00a27c5addfb6b7350a39215b48f4aaffa5960c.tar.bz2 |
gdb: Fix "info os <unknown>" command
Running `info os someUnknownOsType` is crashing when gdb is built with
-D_GLIBCXX_DEBUG:
/usr/include/c++/5/debug/vector:439:error: attempt to
access an element in an empty container.
In target_read_stralloc from target.c, the call to
target_read_alloc_1 can return an empty vector, we then call vector::back on
this vector, which is invalid.
This commit adds a check for emptiness before trying to call
vector::back on it. It also adds test to check for `info os <unknown>`
to return the proper error message.
This is a regression in gdb 8.2 and this patch restores the behavior of
previous versions.
gdb/ChangeLog:
PR gdb/23974
* target.c (target_read_stralloc): Check for empty vector.
gdb/testsuite/ChangeLog:
PR gdb/23974
* gdb.base/info-os.exp: Check return for unknown "info os" type.
Diffstat (limited to 'gas/symbols.c')
0 files changed, 0 insertions, 0 deletions