diff options
author | Pedro Alves <palves@redhat.com> | 2018-08-21 16:48:30 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-08-21 16:48:30 +0100 |
commit | 4895f384b47628c8c354dccbb0bfab45b8c33984 (patch) | |
tree | 234161ab89a377ef079869d8663b41f4a2719202 /bfd/elf32-s12z.c | |
parent | ae19acf3201ee0b921cde8e70e278fe123e82105 (diff) | |
download | gdb-4895f384b47628c8c354dccbb0bfab45b8c33984.zip gdb-4895f384b47628c8c354dccbb0bfab45b8c33984.tar.gz gdb-4895f384b47628c8c354dccbb0bfab45b8c33984.tar.bz2 |
Don't throw Scheme exceptions with live std::vector objects
A complication with the Guile code is that we have two types of
exceptions to consider: GDB/C++ exceptions, and Guile/SJLJ exceptions.
Because Guile exceptions are SJLJ based, we must make sure to not have
live local variables of types with non-trivial dtors when a Guile
exception is thrown, because the dtors won't be run when a Guile
exceptions is thrown.
gdbscm_parse_function_args currently violates this:
void
gdbscm_parse_function_args (const char *func_name,
int beginning_arg_pos,
const SCM *keywords,
const char *format, ...)
{
...
/* Keep track of malloc'd strings. We need to free them upon error. */
std::vector<char *> allocated_strings;
...
for (char *ptr : allocated_strings)
xfree (ptr);
gdbscm_throw (status); /// dtor of "allocated_strings" is not run!
}
This commit fixes the above making using of gdbscm_wrap.
It would be nice if we had a way to make it impossible to write such
code. PR guile/23429 has an idea for that, if someone's interested.
gdb/ChangeLog:
2018-08-21 Pedro Alves <palves@redhat.com>
* guile/scm-utils.c (gdbscm_parse_function_args_1): New, factored
out from gdbscm_parse_function_args.
(gdbscm_parse_function_args): Rework to use gdbscm_wrap and
gdbscm_parse_function_args_1.
Diffstat (limited to 'bfd/elf32-s12z.c')
0 files changed, 0 insertions, 0 deletions