This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 15/22] Make exceptions use std::string and be self-managing
- From: Tom Tromey <tom at tromey dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Wed, 03 Apr 2019 11:58:15 -0600
- Subject: Re: [PATCH v2 15/22] Make exceptions use std::string and be self-managing
- References: <20190227201849.32210-1-tom@tromey.com> <20190227201849.32210-16-tom@tromey.com> <f6f7893d-d3dc-6b68-adb8-88c710da19ca@redhat.com>
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> I think fixing this isn't hard, so I think we should do it from the
Pedro> start -- instead of gdb_exception holding a std::string, hold a
Pedro> reference counted immutable heap-allocated C string.
I'll do this.
How about just a std::shared_ptr<std::string>? Or would you rather
plain std::shared_ptr<char>? I don't recall offhand if having a real
string was handy anywhere or not.
Pedro> Since you're touching most (all?) lines that refer to "message",
Pedro> did you consider adding a "what()" method, to model what
Pedro> std::exception has?
Pedro> const char *what() const noexcept;
Pedro> Maybe that helps with newcomers' familiarity?
I didn't think of it, but I can do this.
Tom