Pedro Alves 56be6ea89c 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.
2019-04-08 20:13:32 +01:00
..
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-03-06 16:04:31 -07:00
2019-03-06 16:04:31 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-01-24 18:01:49 +00:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-04-08 09:05:40 -06:00
2019-01-09 18:28:14 -07:00
2019-02-07 03:27:23 -07:00
2019-02-12 13:56:16 -08:00
2019-02-12 13:56:16 -08:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-01-23 19:02:58 +00:00
2019-04-08 09:05:40 -06:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-01-23 18:58:28 +00:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00
2019-02-07 03:27:23 -07:00