diff options
author | Pedro Alves <palves@redhat.com> | 2019-04-08 13:03:54 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2019-04-08 20:13:32 +0100 |
commit | 56be6ea89cdf94078d5dff3734b8c1970dbf52fa (patch) | |
tree | 72a8d6b1b905e36c0f59f3d522130598be0d221e /ld/scripttempl | |
parent | 3ae61bb67d62eb53d110835b8b7c3a289e6bce45 (diff) | |
download | gdb-56be6ea89cdf94078d5dff3734b8c1970dbf52fa.zip gdb-56be6ea89cdf94078d5dff3734b8c1970dbf52fa.tar.gz gdb-56be6ea89cdf94078d5dff3734b8c1970dbf52fa.tar.bz2 |
Some gdb_exception{,error,quit} tweaks
- Explicitly include <string> for std::string.
- Use std::make_shared to construct gdb_exception::message instead of
operator new, avoiding one heap allocation (2 instead of 3). Add
'const char *fmt, va_list ap' parameters to
gdb_exception{,error,quit}'s ctors, and do the std::make_shared in
the gdb_exception ctor.
- gdb_exception_error's constructor does not need to have an 'enum
return_reason' parameter, since it is always RETURN_ERROR, by
definition.
- Similarly, gdb_exception_quit's contructor does not need to have
'enum return_reason'/'enum errors' parameters.
- In the gdb_exception_{quit,_error} ctors that take a gdb_exception
as argument, assert that they're being passed a gdb_exception object
of the right 'reason'.
gdb/ChangeLog:
2019-04-08 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (throw_exception): Don't create
named object to throw; throw directly.
(throw_it): Likewise. Don't initialize gdb_exception::message
here, with new; pass FMT and AP to the ctor instead.
* common/common-exceptions.h: Include <string>.
(gdb_exception::gdb_exception(enum return_reason, enum errors,
const char *, va_list)): New ctor. Use std::make_shared.
(gdb_exception_error::gdb_exception_error(enum return_reason, enum
errors)): Delete.
(gdb_exception_error::gdb_exception_error(enum errors, const char
*, va_list)): New.
(gdb_exception_error::gdb_exception_error(const gdb_exception &)):
Add assertion.
(gdb_exception_quit::gdb_exception_quit(enum return_reason, enum
errors)): Delete.
(gdb_exception_quit::gdb_exception_quit(const char *, va_list)): New.
(gdb_exception_quit::gdb_exception_quit(const gdb_exception &)):
Add assertion.
Diffstat (limited to 'ld/scripttempl')
0 files changed, 0 insertions, 0 deletions