* [RFA 01/10] Return std::string from memory_error_message
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
2017-08-29 19:25 ` [RFA 06/10] Use std::string in do_set_command Tom Tromey
@ 2017-08-29 19:25 ` Tom Tromey
2017-08-29 19:25 ` [RFA 09/10] Use std::string and unique_xmalloc_ptr in compile/ code Tom Tromey
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes memory_error_message to return a std::string and fixes up
the callers. This removes some cleanups.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* valprint.c (val_print_string): Update.
* gdbcore.h (memory_error_message): Return std::string.
* corefile.c (memory_error_message): Return std::string.
(memory_error): Update.
* breakpoint.c (insert_bp_location): Update.
---
gdb/ChangeLog | 8 ++++++++
gdb/breakpoint.c | 6 ++----
gdb/corefile.c | 16 +++++++---------
gdb/gdbcore.h | 8 ++++----
gdb/valprint.c | 7 ++-----
5 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 926c966..7e3b7bf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2017-08-29 Tom Tromey <tom@tromey.com>
+
+ * valprint.c (val_print_string): Update.
+ * gdbcore.h (memory_error_message): Return std::string.
+ * corefile.c (memory_error_message): Return std::string.
+ (memory_error): Update.
+ * breakpoint.c (insert_bp_location): Update.
+
2017-08-28 Simon Marchi <simon.marchi@ericsson.com>
PR gdb/21827
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index ae09da4..e1fb6b5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2889,16 +2889,14 @@ insert_bp_location (struct bp_location *bl,
{
if (bp_err_message == NULL)
{
- char *message
+ std::string message
= memory_error_message (TARGET_XFER_E_IO,
bl->gdbarch, bl->address);
- struct cleanup *old_chain = make_cleanup (xfree, message);
fprintf_unfiltered (tmp_error_stream,
"Cannot insert breakpoint %d.\n"
"%s\n",
- bl->owner->number, message);
- do_cleanups (old_chain);
+ bl->owner->number, message.c_str ());
}
else
{
diff --git a/gdb/corefile.c b/gdb/corefile.c
index d9773cf..5631347 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -186,7 +186,7 @@ Use the \"file\" or \"exec-file\" command."));
}
\f
-char *
+std::string
memory_error_message (enum target_xfer_status err,
struct gdbarch *gdbarch, CORE_ADDR memaddr)
{
@@ -195,11 +195,11 @@ memory_error_message (enum target_xfer_status err,
case TARGET_XFER_E_IO:
/* Actually, address between memaddr and memaddr + len was out of
bounds. */
- return xstrprintf (_("Cannot access memory at address %s"),
- paddress (gdbarch, memaddr));
+ return string_printf (_("Cannot access memory at address %s"),
+ paddress (gdbarch, memaddr));
case TARGET_XFER_UNAVAILABLE:
- return xstrprintf (_("Memory at address %s unavailable."),
- paddress (gdbarch, memaddr));
+ return string_printf (_("Memory at address %s unavailable."),
+ paddress (gdbarch, memaddr));
default:
internal_error (__FILE__, __LINE__,
"unhandled target_xfer_status: %s (%s)",
@@ -213,12 +213,10 @@ memory_error_message (enum target_xfer_status err,
void
memory_error (enum target_xfer_status err, CORE_ADDR memaddr)
{
- char *str;
enum errors exception = GDB_NO_ERROR;
/* Build error string. */
- str = memory_error_message (err, target_gdbarch (), memaddr);
- make_cleanup (xfree, str);
+ std::string str = memory_error_message (err, target_gdbarch (), memaddr);
/* Choose the right error to throw. */
switch (err)
@@ -232,7 +230,7 @@ memory_error (enum target_xfer_status err, CORE_ADDR memaddr)
}
/* Throw it. */
- throw_error (exception, ("%s"), str);
+ throw_error (exception, ("%s"), str.c_str ());
}
/* Helper function. */
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 87f3dcd..a25a231 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -37,11 +37,11 @@ extern int have_core_file_p (void);
extern void memory_error (enum target_xfer_status status, CORE_ADDR memaddr);
-/* The string 'memory_error' would use as exception message. Space
- for the result is malloc'd, caller must free. */
+/* The string 'memory_error' would use as exception message. */
-extern char *memory_error_message (enum target_xfer_status err,
- struct gdbarch *gdbarch, CORE_ADDR memaddr);
+extern std::string memory_error_message (enum target_xfer_status err,
+ struct gdbarch *gdbarch,
+ CORE_ADDR memaddr);
/* Like target_read_memory, but report an error if can't read. */
diff --git a/gdb/valprint.c b/gdb/valprint.c
index eef99b1..5b02e2f 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -2988,13 +2988,10 @@ val_print_string (struct type *elttype, const char *encoding,
if (err != 0)
{
- char *str;
-
- str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr);
- make_cleanup (xfree, str);
+ std::string str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr);
fprintf_filtered (stream, "<error: ");
- fputs_filtered (str, stream);
+ fputs_filtered (str.c_str (), stream);
fprintf_filtered (stream, ">");
}
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 08/10] Return std::string from perror_string
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
` (4 preceding siblings ...)
2017-08-29 19:25 ` [RFA 04/10] Use std::string in mi_cmd_interpreter_exec Tom Tromey
@ 2017-08-29 19:25 ` Tom Tromey
2017-08-29 19:25 ` [RFA 07/10] Use std::string and unique_xmalloc_ptr in demangle_command Tom Tromey
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Change perror_string to return a std::string, removing a cleanup in
the process.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* utils.c (perror_string): Return a std::string.
(throw_perror_with_name, perror_warning_with_name): Update.
---
gdb/ChangeLog | 5 +++++
gdb/utils.c | 28 +++++++---------------------
2 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 34e5b3c..b301516 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * utils.c (perror_string): Return a std::string.
+ (throw_perror_with_name, perror_warning_with_name): Update.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* demangle.c (demangle_command): Use std::string,
unique_xmalloc_ptr.
diff --git a/gdb/utils.c b/gdb/utils.c
index 3ca29b7..af50cf0 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -751,23 +751,15 @@ add_internal_problem_command (struct internal_problem *problem)
}
/* Return a newly allocated string, containing the PREFIX followed
- by the system error message for errno (separated by a colon).
+ by the system error message for errno (separated by a colon). */
- The result must be deallocated after use. */
-
-static char *
+static std::string
perror_string (const char *prefix)
{
char *err;
- char *combined;
err = safe_strerror (errno);
- combined = (char *) xmalloc (strlen (err) + strlen (prefix) + 3);
- strcpy (combined, prefix);
- strcat (combined, ": ");
- strcat (combined, err);
-
- return combined;
+ return std::string (prefix) + ": " + err;
}
/* Print the system error message for errno, and also mention STRING
@@ -777,10 +769,7 @@ perror_string (const char *prefix)
void
throw_perror_with_name (enum errors errcode, const char *string)
{
- char *combined;
-
- combined = perror_string (string);
- make_cleanup (xfree, combined);
+ std::string combined = perror_string (string);
/* I understand setting these is a matter of taste. Still, some people
may clear errno but not know about bfd_error. Doing this here is not
@@ -788,7 +777,7 @@ throw_perror_with_name (enum errors errcode, const char *string)
bfd_set_error (bfd_error_no_error);
errno = 0;
- throw_error (errcode, _("%s."), combined);
+ throw_error (errcode, _("%s."), combined.c_str ());
}
/* See throw_perror_with_name, ERRCODE defaults here to GENERIC_ERROR. */
@@ -805,11 +794,8 @@ perror_with_name (const char *string)
void
perror_warning_with_name (const char *string)
{
- char *combined;
-
- combined = perror_string (string);
- warning (_("%s"), combined);
- xfree (combined);
+ std::string combined = perror_string (string);
+ warning (_("%s"), combined.c_str ());
}
/* Print the system error message for ERRCODE, and also mention STRING
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 09/10] Use std::string and unique_xmalloc_ptr in compile/ code
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
2017-08-29 19:25 ` [RFA 06/10] Use std::string in do_set_command Tom Tromey
2017-08-29 19:25 ` [RFA 01/10] Return std::string from memory_error_message Tom Tromey
@ 2017-08-29 19:25 ` Tom Tromey
2017-08-30 18:24 ` Keith Seitz
2017-08-29 19:25 ` [RFA 05/10] Use unique_xmalloc_ptr in cd_command Tom Tromey
` (7 subsequent siblings)
10 siblings, 1 reply; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Change various things in the compile/ code to use std::string or
unique_xmalloc_ptr as appropriate. This allows the removal of some
cleanups.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* compile/compile.c (compile_register_name_mangled): Return
std::string.
* compile/compile-loc2c.c (pushf_register_address): Update.
(pushf_register): Update.
* compile/compile-c-types.c (convert_array): Update.
* compile/compile-c-symbols.c (generate_vla_size): Update.
(error_symbol_once): Use a gdb::unique_xmalloc_ptr.
(symbol_substitution_name): Return a gdb::unique_xmalloc_ptr.
(convert_one_symbol): Update.
(generate_c_for_for_one_variable): Update.
* compile/compile-c-support.c (c_get_range_decl_name): Return a
std::string.
(generate_register_struct): Update.
* compile/compile-internal.h (c_get_range_decl_name): Return a
std::string.
(compile_register_name_mangled): Return std::string.
---
gdb/ChangeLog | 19 +++++++++++++++++++
gdb/compile/compile-c-support.c | 16 +++++++---------
gdb/compile/compile-c-symbols.c | 32 +++++++++++++-------------------
gdb/compile/compile-c-types.c | 7 +++----
gdb/compile/compile-internal.h | 16 +++++++---------
gdb/compile/compile-loc2c.c | 16 +++++-----------
gdb/compile/compile.c | 4 ++--
7 files changed, 56 insertions(+), 54 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b301516..cc679ea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,24 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * compile/compile.c (compile_register_name_mangled): Return
+ std::string.
+ * compile/compile-loc2c.c (pushf_register_address): Update.
+ (pushf_register): Update.
+ * compile/compile-c-types.c (convert_array): Update.
+ * compile/compile-c-symbols.c (generate_vla_size): Update.
+ (error_symbol_once): Use a gdb::unique_xmalloc_ptr.
+ (symbol_substitution_name): Return a gdb::unique_xmalloc_ptr.
+ (convert_one_symbol): Update.
+ (generate_c_for_for_one_variable): Update.
+ * compile/compile-c-support.c (c_get_range_decl_name): Return a
+ std::string.
+ (generate_register_struct): Update.
+ * compile/compile-internal.h (c_get_range_decl_name): Return a
+ std::string.
+ (compile_register_name_mangled): Return std::string.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* utils.c (perror_string): Return a std::string.
(throw_perror_with_name, perror_warning_with_name): Update.
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index 3bec28c..6f759ab 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -58,10 +58,10 @@ c_get_mode_for_size (int size)
/* See compile-internal.h. */
-char *
+std::string
c_get_range_decl_name (const struct dynamic_prop *prop)
{
- return xstrprintf ("__gdb_prop_%s", host_address_to_string (prop));
+ return string_printf ("__gdb_prop_%s", host_address_to_string (prop));
}
\f
@@ -263,8 +263,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
if (registers_used[i])
{
struct type *regtype = check_typedef (register_type (gdbarch, i));
- char *regname = compile_register_name_mangled (gdbarch, i);
- struct cleanup *cleanups = make_cleanup (xfree, regname);
+ std::string regname = compile_register_name_mangled (gdbarch, i);
seen = 1;
@@ -282,7 +281,8 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
switch (TYPE_CODE (regtype))
{
case TYPE_CODE_PTR:
- fprintf_filtered (stream, "__gdb_uintptr %s", regname);
+ fprintf_filtered (stream, "__gdb_uintptr %s",
+ regname.c_str ());
break;
case TYPE_CODE_INT:
@@ -297,7 +297,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
fprintf_unfiltered (stream,
"int %s"
" __attribute__ ((__mode__(__%s__)))",
- regname,
+ regname.c_str (),
mode);
break;
}
@@ -310,12 +310,10 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
" unsigned char %s[%d]"
" __attribute__((__aligned__("
"__BIGGEST_ALIGNMENT__)))",
- regname,
+ regname.c_str (),
TYPE_LENGTH (regtype));
}
fputs_unfiltered (";\n", stream);
-
- do_cleanups (cleanups);
}
}
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 15e1d6d..1cdea85 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -107,7 +107,6 @@ error_symbol_once (struct compile_c_instance *context,
{
struct symbol_error search;
struct symbol_error *err;
- char *message;
if (context->symbol_err_map == NULL)
return;
@@ -117,10 +116,9 @@ error_symbol_once (struct compile_c_instance *context,
if (err == NULL || err->message == NULL)
return;
- message = err->message;
+ gdb::unique_xmalloc_ptr<char> message (err->message);
err->message = NULL;
- make_cleanup (xfree, message);
- error (_("%s"), message);
+ error (_("%s"), message.get ());
}
\f
@@ -128,10 +126,11 @@ error_symbol_once (struct compile_c_instance *context,
/* Compute the name of the pointer representing a local symbol's
address. */
-static char *
+static gdb::unique_xmalloc_ptr<char>
symbol_substitution_name (struct symbol *sym)
{
- return concat ("__", SYMBOL_NATURAL_NAME (sym), "_ptr", (char *) NULL);
+ return gdb::unique_xmalloc_ptr<char>
+ (concat ("__", SYMBOL_NATURAL_NAME (sym), "_ptr", (char *) NULL));
}
/* Convert a given symbol, SYM, to the compiler's representation.
@@ -170,7 +169,7 @@ convert_one_symbol (struct compile_c_instance *context,
gcc_decl decl;
enum gcc_c_symbol_kind kind;
CORE_ADDR addr = 0;
- char *symbol_name = NULL;
+ gdb::unique_xmalloc_ptr<char> symbol_name;
switch (SYMBOL_CLASS (sym.symbol))
{
@@ -290,13 +289,11 @@ convert_one_symbol (struct compile_c_instance *context,
SYMBOL_NATURAL_NAME (sym.symbol),
kind,
sym_type,
- symbol_name, addr,
+ symbol_name.get (), addr,
filename, line);
C_CTX (context)->c_ops->bind (C_CTX (context), decl, is_global);
}
-
- xfree (symbol_name);
}
}
@@ -604,13 +601,11 @@ generate_vla_size (struct compile_c_instance *compiler,
|| TYPE_HIGH_BOUND_KIND (type) == PROP_LOCLIST)
{
const struct dynamic_prop *prop = &TYPE_RANGE_DATA (type)->high;
- char *name = c_get_range_decl_name (prop);
- struct cleanup *cleanup = make_cleanup (xfree, name);
+ std::string name = c_get_range_decl_name (prop);
- dwarf2_compile_property_to_c (stream, name,
+ dwarf2_compile_property_to_c (stream, name.c_str (),
gdbarch, registers_used,
prop, pc, sym);
- do_cleanups (cleanup);
}
}
break;
@@ -663,8 +658,8 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
if (SYMBOL_COMPUTED_OPS (sym) != NULL)
{
- char *generated_name = symbol_substitution_name (sym);
- struct cleanup *cleanup = make_cleanup (xfree, generated_name);
+ gdb::unique_xmalloc_ptr<char> generated_name
+ = symbol_substitution_name (sym);
/* We need to emit to a temporary buffer in case an error
occurs in the middle. */
string_file local_file;
@@ -672,10 +667,9 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
SYMBOL_COMPUTED_OPS (sym)->generate_c_location (sym, local_file,
gdbarch,
registers_used,
- pc, generated_name);
+ pc,
+ generated_name.get ());
stream.write (local_file.c_str (), local_file.size ());
-
- do_cleanups (cleanup);
}
else
{
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index 22aee78..dc6391c 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -123,18 +123,17 @@ convert_array (struct compile_c_instance *context, struct type *type)
|| TYPE_HIGH_BOUND_KIND (range) == PROP_LOCLIST)
{
gcc_type result;
- char *upper_bound;
if (TYPE_VECTOR (type))
return C_CTX (context)->c_ops->error (C_CTX (context),
_("variably-sized vector type"
" is not supported"));
- upper_bound = c_get_range_decl_name (&TYPE_RANGE_DATA (range)->high);
+ std::string upper_bound
+ = c_get_range_decl_name (&TYPE_RANGE_DATA (range)->high);
result = C_CTX (context)->c_ops->build_vla_array_type (C_CTX (context),
element_type,
- upper_bound);
- xfree (upper_bound);
+ upper_bound.c_str ());
return result;
}
else
diff --git a/gdb/compile/compile-internal.h b/gdb/compile/compile-internal.h
index 0c53f8c..091e654 100644
--- a/gdb/compile/compile-internal.h
+++ b/gdb/compile/compile-internal.h
@@ -95,11 +95,10 @@ struct compile_c_instance
/* Call gdbarch_register_name (GDBARCH, REGNUM) and convert its result
to a form suitable for the compiler source. The register names
- should not clash with inferior defined macros. Returned pointer is
- never NULL. Returned pointer needs to be deallocated by xfree. */
+ should not clash with inferior defined macros. */
-extern char *compile_register_name_mangled (struct gdbarch *gdbarch,
- int regnum);
+extern std::string compile_register_name_mangled (struct gdbarch *gdbarch,
+ int regnum);
/* Convert compiler source register name to register number of
GDBARCH. Returned value is always >= 0, function throws an error
@@ -144,13 +143,12 @@ extern unsigned char *generate_c_for_variable_locations
extern const char *c_get_mode_for_size (int size);
-/* Given a dynamic property, return an xmallocd name that is used to
- represent its size. The result must be freed by the caller. The
- contents of the resulting string will be the same each time for
- each call with the same argument. */
+/* Given a dynamic property, return a name that is used to represent
+ its size. The contents of the resulting string will be the same
+ each time for each call with the same argument. */
struct dynamic_prop;
-extern char *c_get_range_decl_name (const struct dynamic_prop *prop);
+extern std::string c_get_range_decl_name (const struct dynamic_prop *prop);
/* Type used to hold and pass around the source and object file names
to use for compilation. */
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index ead1003..7ec6f67 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -515,15 +515,12 @@ pushf_register_address (int indent, string_file &stream,
unsigned char *registers_used,
struct gdbarch *gdbarch, int regnum)
{
- char *regname = compile_register_name_mangled (gdbarch, regnum);
- struct cleanup *cleanups = make_cleanup (xfree, regname);
+ std::string regname = compile_register_name_mangled (gdbarch, regnum);
registers_used[regnum] = 1;
pushf (indent, stream,
"(" GCC_UINTPTR ") &" COMPILE_I_SIMPLE_REGISTER_ARG_NAME "->%s",
- regname);
-
- do_cleanups (cleanups);
+ regname.c_str ());
}
/* Emit code that pushes a register's value on the stack.
@@ -536,19 +533,16 @@ pushf_register (int indent, string_file &stream,
unsigned char *registers_used,
struct gdbarch *gdbarch, int regnum, uint64_t offset)
{
- char *regname = compile_register_name_mangled (gdbarch, regnum);
- struct cleanup *cleanups = make_cleanup (xfree, regname);
+ std::string regname = compile_register_name_mangled (gdbarch, regnum);
registers_used[regnum] = 1;
if (offset == 0)
pushf (indent, stream, COMPILE_I_SIMPLE_REGISTER_ARG_NAME "->%s",
- regname);
+ regname.c_str ());
else
pushf (indent, stream,
COMPILE_I_SIMPLE_REGISTER_ARG_NAME "->%s + (" GCC_UINTPTR ") %s",
- regname, hex_string (offset));
-
- do_cleanups (cleanups);
+ regname.c_str (), hex_string (offset));
}
/* Compile a DWARF expression to C code.
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index bbb31f1..e4865d0 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -648,12 +648,12 @@ eval_compile_command (struct command_line *cmd, const char *cmd_string,
/* See compile/compile-internal.h. */
-char *
+std::string
compile_register_name_mangled (struct gdbarch *gdbarch, int regnum)
{
const char *regname = gdbarch_register_name (gdbarch, regnum);
- return xstrprintf ("__%s", regname);
+ return string_printf ("__%s", regname);
}
/* See compile/compile-internal.h. */
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 07/10] Use std::string and unique_xmalloc_ptr in demangle_command
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
` (5 preceding siblings ...)
2017-08-29 19:25 ` [RFA 08/10] Return std::string from perror_string Tom Tromey
@ 2017-08-29 19:25 ` Tom Tromey
2017-08-29 19:36 ` [RFA 02/10] Use std::string thread.c Tom Tromey
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Change demangle_command to use std::string and unique_xmalloc_ptr,
removing some cleanups.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* demangle.c (demangle_command): Use std::string,
unique_xmalloc_ptr.
---
gdb/ChangeLog | 5 +++++
gdb/demangle.c | 36 +++++++++++++-----------------------
2 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0cf0fe9..34e5b3c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * demangle.c (demangle_command): Use std::string,
+ unique_xmalloc_ptr.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* cli/cli-setshow.c (do_set_command): Use std::string.
2017-08-29 Tom Tromey <tom@tromey.com>
diff --git a/gdb/demangle.c b/gdb/demangle.c
index 2d79c1d..8823569 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -161,41 +161,33 @@ is_cplus_marker (int c)
static void
demangle_command (char *args, int from_tty)
{
- char *demangled, *name, *lang_name = NULL;
- char *arg_buf, *arg_start;
+ char *demangled;
+ const char *name;
+ const char *arg_start;
int processing_args = 1;
const struct language_defn *lang;
- struct cleanup *cleanups;
- arg_buf = xstrdup (args != NULL ? args : "");
- cleanups = make_cleanup (xfree, arg_buf);
- arg_start = arg_buf;
+ std::string arg_buf = args != NULL ? args : "";
+ arg_start = arg_buf.c_str ();
+ gdb::unique_xmalloc_ptr<char> lang_name;
while (processing_args
&& *arg_start == '-')
{
- char *p = skip_to_space (arg_start);
+ const char *p = skip_to_space_const (arg_start);
if (strncmp (arg_start, "-l", p - arg_start) == 0)
- {
- char *lang_name_end;
-
- lang_name = skip_spaces (p);
- lang_name_end = skip_to_space (lang_name);
- lang_name = savestring (lang_name, lang_name_end - lang_name);
- make_cleanup (xfree, lang_name);
- p = lang_name_end;
- }
+ lang_name.reset (extract_arg_const (&p));
else if (strncmp (arg_start, "--", p - arg_start) == 0)
processing_args = 0;
else
{
- *p = '\0';
+ gdb::unique_xmalloc_ptr<char> option (extract_arg_const (&p));
error (_("Unrecognized option '%s' to demangle command. "
- "Try \"help demangle\"."), arg_start);
+ "Try \"help demangle\"."), option.get ());
}
- arg_start = skip_spaces (p);
+ arg_start = skip_spaces_const (p);
}
name = arg_start;
@@ -207,9 +199,9 @@ demangle_command (char *args, int from_tty)
{
enum language lang_enum;
- lang_enum = language_enum (lang_name);
+ lang_enum = language_enum (lang_name.get ());
if (lang_enum == language_unknown)
- error (_("Unknown language \"%s\""), lang_name);
+ error (_("Unknown language \"%s\""), lang_name.get ());
lang = language_def (lang_enum);
}
else
@@ -223,8 +215,6 @@ demangle_command (char *args, int from_tty)
}
else
error (_("Can't demangle \"%s\""), name);
-
- do_cleanups (cleanups);
}
extern initialize_file_ftype _initialize_demangler; /* -Wmissing-prototypes */
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 05/10] Use unique_xmalloc_ptr in cd_command
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
` (2 preceding siblings ...)
2017-08-29 19:25 ` [RFA 09/10] Use std::string and unique_xmalloc_ptr in compile/ code Tom Tromey
@ 2017-08-29 19:25 ` Tom Tromey
2017-08-29 19:25 ` [RFA 04/10] Use std::string in mi_cmd_interpreter_exec Tom Tromey
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Change cd_command to use unique_xmalloc_ptr, removing a cleanup.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* cli/cli-cmds.c (cd_command): Use gdb::unique_xmalloc_ptr.
---
gdb/ChangeLog | 4 ++++
gdb/cli/cli-cmds.c | 20 +++++++++-----------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b13ce63..1d9ff74 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * cli/cli-cmds.c (cd_command): Use gdb::unique_xmalloc_ptr.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* mi/mi-interp.c (mi_cmd_interpreter_exec): Use std::string.
2017-08-29 Tom Tromey <tom@tromey.com>
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d4dc539..8221747 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -398,14 +398,14 @@ cd_command (char *dir, int from_tty)
/* Found something other than leading repetitions of "/..". */
int found_real_path;
char *p;
- struct cleanup *cleanup;
/* If the new directory is absolute, repeat is a no-op; if relative,
repeat might be useful but is more likely to be a mistake. */
dont_repeat ();
- dir = tilde_expand (dir != NULL ? dir : "~");
- cleanup = make_cleanup (xfree, dir);
+ gdb::unique_xmalloc_ptr<char> dir_holder
+ (tilde_expand (dir != NULL ? dir : "~"));
+ dir = dir_holder.get ();
if (chdir (dir) < 0)
perror_with_name (dir);
@@ -430,17 +430,17 @@ cd_command (char *dir, int from_tty)
len--;
}
- dir = savestring (dir, len);
- if (IS_ABSOLUTE_PATH (dir))
- current_directory = dir;
+ dir_holder.reset (savestring (dir, len));
+ if (IS_ABSOLUTE_PATH (dir_holder.get ()))
+ current_directory = dir_holder.release ();
else
{
if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]))
- current_directory = concat (current_directory, dir, (char *)NULL);
+ current_directory = concat (current_directory, dir_holder.get (),
+ (char *) NULL);
else
current_directory = concat (current_directory, SLASH_STRING,
- dir, (char *)NULL);
- xfree (dir);
+ dir_holder.get (), (char *) NULL);
}
/* Now simplify any occurrences of `.' and `..' in the pathname. */
@@ -489,8 +489,6 @@ cd_command (char *dir, int from_tty)
if (from_tty)
pwd_command ((char *) 0, 1);
-
- do_cleanups (cleanup);
}
\f
/* Show the current value of the 'script-extension' option. */
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 06/10] Use std::string in do_set_command
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
@ 2017-08-29 19:25 ` Tom Tromey
2017-08-29 19:25 ` [RFA 01/10] Return std::string from memory_error_message Tom Tromey
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Change do_set_command to use std::string, removing a cleanup and some
manual resizing code.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* cli/cli-setshow.c (do_set_command): Use std::string.
---
gdb/ChangeLog | 4 ++++
gdb/cli/cli-setshow.c | 16 ++++------------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1d9ff74..0cf0fe9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * cli/cli-setshow.c (do_set_command): Use std::string.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* cli/cli-cmds.c (cd_command): Use gdb::unique_xmalloc_ptr.
2017-08-29 Tom Tromey <tom@tromey.com>
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index fb0bd49..c6e5ebc 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -367,24 +367,16 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
message. */
if (arg == NULL)
{
- char *msg;
- int msg_len = 0;
-
- for (i = 0; c->enums[i]; i++)
- msg_len += strlen (c->enums[i]) + 2;
-
- msg = (char *) xmalloc (msg_len);
- *msg = '\0';
- make_cleanup (xfree, msg);
+ std::string msg;
for (i = 0; c->enums[i]; i++)
{
if (i != 0)
- strcat (msg, ", ");
- strcat (msg, c->enums[i]);
+ msg += ", ";
+ msg += c->enums[i];
}
error (_("Requires an argument. Valid arguments are %s."),
- msg);
+ msg.c_str ());
}
p = strchr (arg, ' ');
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 00/10] some string cleanup removal
@ 2017-08-29 19:25 Tom Tromey
2017-08-29 19:25 ` [RFA 06/10] Use std::string in do_set_command Tom Tromey
` (10 more replies)
0 siblings, 11 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:25 UTC (permalink / raw)
To: gdb-patches
This series removes some cleanups in favor of std::string or
gdb::unique_xmalloc_ptr, as appropriate.
There are many more changes like this to be made, this is just a
random sampler.
Regtested on the buildbot.
Tom
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 04/10] Use std::string in mi_cmd_interpreter_exec
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
` (3 preceding siblings ...)
2017-08-29 19:25 ` [RFA 05/10] Use unique_xmalloc_ptr in cd_command Tom Tromey
@ 2017-08-29 19:25 ` Tom Tromey
2017-08-29 19:25 ` [RFA 08/10] Return std::string from perror_string Tom Tromey
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Change mi_cmd_interpreter_exec to use std::string, removing a cleanup.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* mi/mi-interp.c (mi_cmd_interpreter_exec): Use std::string.
---
gdb/ChangeLog | 4 ++++
gdb/mi/mi-interp.c | 12 ++++--------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9c8bb47..b13ce63 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * mi/mi-interp.c (mi_cmd_interpreter_exec): Use std::string.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* mi/mi-cmd-env.c (env_execute_cli_command): Use
gdb::unique_xmalloc_ptr.
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 959ae37..6b6d8f0 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -206,8 +206,6 @@ mi_cmd_interpreter_exec (const char *command, char **argv, int argc)
{
struct interp *interp_to_use;
int i;
- char *mi_error_message = NULL;
- struct cleanup *old_chain;
if (argc < 2)
error (_("-interpreter-exec: "
@@ -231,24 +229,22 @@ mi_cmd_interpreter_exec (const char *command, char **argv, int argc)
/* Now run the code. */
- old_chain = make_cleanup (null_cleanup, 0);
+ std::string mi_error_message;
for (i = 1; i < argc; i++)
{
struct gdb_exception e = interp_exec (interp_to_use, argv[i]);
if (e.reason < 0)
{
- mi_error_message = xstrdup (e.message);
- make_cleanup (xfree, mi_error_message);
+ mi_error_message = e.message;
break;
}
}
mi_remove_notify_hooks ();
- if (mi_error_message != NULL)
- error ("%s", mi_error_message);
- do_cleanups (old_chain);
+ if (!mi_error_message.empty ())
+ error ("%s", mi_error_message.c_str ());
}
/* This inserts a number of hooks that are meant to produce
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 02/10] Use std::string thread.c
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
` (6 preceding siblings ...)
2017-08-29 19:25 ` [RFA 07/10] Use std::string and unique_xmalloc_ptr in demangle_command Tom Tromey
@ 2017-08-29 19:36 ` Tom Tromey
2017-08-29 19:37 ` [RFA 10/10] Use std::string in reopen_exec_file Tom Tromey
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:36 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes a few spots in thread.c to use std::string, removing some
cleanups.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* thread.c (print_thread_info_1): Use string_printf.
(thread_apply_command, thread_apply_all_command): Use
std::string.
---
gdb/ChangeLog | 6 ++++++
gdb/thread.c | 33 +++++++++++----------------------
2 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7e3b7bf..1c4896c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * thread.c (print_thread_info_1): Use string_printf.
+ (thread_apply_command, thread_apply_all_command): Use
+ std::string.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* valprint.c (val_print_string): Update.
* gdbcore.h (memory_error_message): Return std::string.
* corefile.c (memory_error_message): Return std::string.
diff --git a/gdb/thread.c b/gdb/thread.c
index 3cf1b94..8a0ed0c 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1343,22 +1343,19 @@ print_thread_info_1 (struct ui_out *uiout, char *requested_threads,
}
else
{
- struct cleanup *str_cleanup;
- char *contents;
+ std::string contents;
if (extra_info && name)
- contents = xstrprintf ("%s \"%s\" (%s)", target_id,
- name, extra_info);
+ contents = string_printf ("%s \"%s\" (%s)", target_id,
+ name, extra_info);
else if (extra_info)
- contents = xstrprintf ("%s (%s)", target_id, extra_info);
+ contents = string_printf ("%s (%s)", target_id, extra_info);
else if (name)
- contents = xstrprintf ("%s \"%s\"", target_id, name);
+ contents = string_printf ("%s \"%s\"", target_id, name);
else
- contents = xstrdup (target_id);
- str_cleanup = make_cleanup (xfree, contents);
+ contents = target_id;
- uiout->field_string ("target-id", contents);
- do_cleanups (str_cleanup);
+ uiout->field_string ("target-id", contents.c_str ());
}
if (tp->state == THREAD_RUNNING)
@@ -1701,8 +1698,6 @@ tp_array_compar (const thread_info *a, const thread_info *b)
static void
thread_apply_all_command (char *cmd, int from_tty)
{
- char *saved_cmd;
-
tp_array_compar_ascending = false;
if (cmd != NULL
&& check_for_argument (&cmd, "-ascending", strlen ("-ascending")))
@@ -1718,8 +1713,7 @@ thread_apply_all_command (char *cmd, int from_tty)
/* Save a copy of the command in case it is clobbered by
execute_command. */
- saved_cmd = xstrdup (cmd);
- make_cleanup (xfree, saved_cmd);
+ std::string saved_cmd = cmd;
int tc = live_threads_count ();
if (tc != 0)
@@ -1761,7 +1755,7 @@ thread_apply_all_command (char *cmd, int from_tty)
execute_command (cmd, from_tty);
/* Restore exact command used previously. */
- strcpy (cmd, saved_cmd);
+ strcpy (cmd, saved_cmd.c_str ());
}
}
}
@@ -1772,8 +1766,6 @@ static void
thread_apply_command (char *tidlist, int from_tty)
{
char *cmd = NULL;
- struct cleanup *old_chain;
- char *saved_cmd;
tid_range_parser parser;
if (tidlist == NULL || *tidlist == '\000')
@@ -1799,8 +1791,7 @@ thread_apply_command (char *tidlist, int from_tty)
/* Save a copy of the command in case it is clobbered by
execute_command. */
- saved_cmd = xstrdup (cmd);
- old_chain = make_cleanup (xfree, saved_cmd);
+ std::string saved_cmd = cmd;
scoped_restore_current_thread restore_thread;
@@ -1857,10 +1848,8 @@ thread_apply_command (char *tidlist, int from_tty)
execute_command (cmd, from_tty);
/* Restore exact command used previously. */
- strcpy (cmd, saved_cmd);
+ strcpy (cmd, saved_cmd.c_str ());
}
-
- do_cleanups (old_chain);
}
/* Switch to the specified thread. Will dispatch off to thread_apply_command
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 10/10] Use std::string in reopen_exec_file
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
` (7 preceding siblings ...)
2017-08-29 19:36 ` [RFA 02/10] Use std::string thread.c Tom Tromey
@ 2017-08-29 19:37 ` Tom Tromey
2017-08-29 19:37 ` [RFA 03/10] Use unique_xmalloc_ptr in env_execute_cli_command Tom Tromey
2017-09-01 8:50 ` [RFA 00/10] some string cleanup removal Simon Marchi
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:37 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes reopen_exec_file to use a std::string, removing a
cleanup.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* corefile.c (reopen_exec_file): Use std::string.
---
gdb/ChangeLog | 4 ++++
gdb/corefile.c | 11 +++--------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cc679ea..314a865 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * corefile.c (reopen_exec_file): Use std::string.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* compile/compile.c (compile_register_name_mangled): Return
std::string.
* compile/compile-loc2c.c (pushf_register_address): Update.
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 5631347..0996f9c 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -130,29 +130,24 @@ specify_exec_file_hook (void (*hook) (const char *))
void
reopen_exec_file (void)
{
- char *filename;
int res;
struct stat st;
- struct cleanup *cleanups;
/* Don't do anything if there isn't an exec file. */
if (exec_bfd == NULL)
return;
/* If the timestamp of the exec file has changed, reopen it. */
- filename = xstrdup (bfd_get_filename (exec_bfd));
- cleanups = make_cleanup (xfree, filename);
- res = stat (filename, &st);
+ std::string filename = bfd_get_filename (exec_bfd);
+ res = stat (filename.c_str (), &st);
if (res == 0 && exec_bfd_mtime && exec_bfd_mtime != st.st_mtime)
- exec_file_attach (filename, 0);
+ exec_file_attach (filename.c_str (), 0);
else
/* If we accessed the file since last opening it, close it now;
this stops GDB from holding the executable open after it
exits. */
bfd_cache_close_all ();
-
- do_cleanups (cleanups);
}
\f
/* If we have both a core file and an exec file,
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFA 03/10] Use unique_xmalloc_ptr in env_execute_cli_command
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
` (8 preceding siblings ...)
2017-08-29 19:37 ` [RFA 10/10] Use std::string in reopen_exec_file Tom Tromey
@ 2017-08-29 19:37 ` Tom Tromey
2017-09-01 8:50 ` [RFA 00/10] some string cleanup removal Simon Marchi
10 siblings, 0 replies; 13+ messages in thread
From: Tom Tromey @ 2017-08-29 19:37 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Change env_execute_cli_command to use unique_xmalloc_ptr, removing a
cleanup.
ChangeLog
2017-08-29 Tom Tromey <tom@tromey.com>
* mi/mi-cmd-env.c (env_execute_cli_command): Use
gdb::unique_xmalloc_ptr.
---
gdb/ChangeLog | 5 +++++
gdb/mi/mi-cmd-env.c | 12 ++++--------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1c4896c..9c8bb47 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2017-08-29 Tom Tromey <tom@tromey.com>
+ * mi/mi-cmd-env.c (env_execute_cli_command): Use
+ gdb::unique_xmalloc_ptr.
+
+2017-08-29 Tom Tromey <tom@tromey.com>
+
* thread.c (print_thread_info_1): Use string_printf.
(thread_apply_command, thread_apply_all_command): Use
std::string.
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index bf4578c..f24f387 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -48,17 +48,13 @@ env_execute_cli_command (const char *cmd, const char *args)
{
if (cmd != 0)
{
- struct cleanup *old_cleanups;
- char *run;
+ gdb::unique_xmalloc_ptr<char> run;
if (args != NULL)
- run = xstrprintf ("%s %s", cmd, args);
+ run.reset (xstrprintf ("%s %s", cmd, args));
else
- run = xstrdup (cmd);
- old_cleanups = make_cleanup (xfree, run);
- execute_command ( /*ui */ run, 0 /*from_tty */ );
- do_cleanups (old_cleanups);
- return;
+ run.reset (xstrdup (cmd));
+ execute_command ( /*ui */ run.get (), 0 /*from_tty */ );
}
}
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFA 09/10] Use std::string and unique_xmalloc_ptr in compile/ code
2017-08-29 19:25 ` [RFA 09/10] Use std::string and unique_xmalloc_ptr in compile/ code Tom Tromey
@ 2017-08-30 18:24 ` Keith Seitz
0 siblings, 0 replies; 13+ messages in thread
From: Keith Seitz @ 2017-08-30 18:24 UTC (permalink / raw)
To: gdb-patches
On 08/29/2017 12:25 PM, Tom Tromey wrote:
> Change various things in the compile/ code to use std::string or
> unique_xmalloc_ptr as appropriate. This allows the removal of some
> cleanups.
FWIW, this looks okay to me. [I've manually merged it (locally) with the c++compile branch.]
Keith
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFA 00/10] some string cleanup removal
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
` (9 preceding siblings ...)
2017-08-29 19:37 ` [RFA 03/10] Use unique_xmalloc_ptr in env_execute_cli_command Tom Tromey
@ 2017-09-01 8:50 ` Simon Marchi
10 siblings, 0 replies; 13+ messages in thread
From: Simon Marchi @ 2017-09-01 8:50 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 2017-08-29 21:25, Tom Tromey wrote:
> This series removes some cleanups in favor of std::string or
> gdb::unique_xmalloc_ptr, as appropriate.
>
> There are many more changes like this to be made, this is just a
> random sampler.
>
> Regtested on the buildbot.
>
> Tom
The series LGTM.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-09-01 8:50 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 19:25 [RFA 00/10] some string cleanup removal Tom Tromey
2017-08-29 19:25 ` [RFA 06/10] Use std::string in do_set_command Tom Tromey
2017-08-29 19:25 ` [RFA 01/10] Return std::string from memory_error_message Tom Tromey
2017-08-29 19:25 ` [RFA 09/10] Use std::string and unique_xmalloc_ptr in compile/ code Tom Tromey
2017-08-30 18:24 ` Keith Seitz
2017-08-29 19:25 ` [RFA 05/10] Use unique_xmalloc_ptr in cd_command Tom Tromey
2017-08-29 19:25 ` [RFA 04/10] Use std::string in mi_cmd_interpreter_exec Tom Tromey
2017-08-29 19:25 ` [RFA 08/10] Return std::string from perror_string Tom Tromey
2017-08-29 19:25 ` [RFA 07/10] Use std::string and unique_xmalloc_ptr in demangle_command Tom Tromey
2017-08-29 19:36 ` [RFA 02/10] Use std::string thread.c Tom Tromey
2017-08-29 19:37 ` [RFA 10/10] Use std::string in reopen_exec_file Tom Tromey
2017-08-29 19:37 ` [RFA 03/10] Use unique_xmalloc_ptr in env_execute_cli_command Tom Tromey
2017-09-01 8:50 ` [RFA 00/10] some string cleanup removal Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).