aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-delegates.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2017-12-06 16:27:33 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2017-12-06 16:37:29 -0500
commit9a93831ccc0ba3ba447552069f230e6d93dcbf3f (patch)
tree32472c683e9c5e79e16e7ec0ec61c56f59bb3f5b /gdb/target-delegates.c
parent1c9c7ce078427891a94dc7604ce9e62175ebfda5 (diff)
downloadgdb-9a93831ccc0ba3ba447552069f230e6d93dcbf3f.zip
gdb-9a93831ccc0ba3ba447552069f230e6d93dcbf3f.tar.gz
gdb-9a93831ccc0ba3ba447552069f230e6d93dcbf3f.tar.bz2
Fix syscall group completion
The test gdb.base/catch-syscall.exp has been failing since commit 3d415c26bad3a15eed00d2ddf85c4268df77a4cc Remove cleanups from break-catch-syscall.c The reason is that we are putting into the group_ptr array a pointer to the buffer of the local string object. If the string is small enough to fit in the internal string buffer (used for small string optimizations), the pointer will point to the local object directly. So even if we std::move the string to the vector, the pointer in group_ptr will still point to the local object. When we reuse that object (technically a new instance, but most likely the same memory) for the next syscall, we'll overwrite the previous string. The result is that we'll get less results than expected, since there will be duplicates. We'll also run into problems if we push the string to the vector, and then record the c_str () pointer using the string object in the vector. The vector might get reallocated, the string may move in memory, and our pointer in group_ptr will point to stale memory. Instead, we have to push all the strings first, then, when we know the vector won't change anymore, build the group_ptr array. This is what this patch does. gdb/ChangeLog: * break-catch-syscall.c (catch_syscall_completer): Get pointers to syscall group strings after building the string vector.
Diffstat (limited to 'gdb/target-delegates.c')
0 files changed, 0 insertions, 0 deletions