aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-10-02 16:58:49 -0600
committerTom Tromey <tom@tromey.com>2021-10-20 11:00:32 -0600
commit23d6ee640578968b0ddef8e08d7dbb5b558a9ce9 (patch)
tree311ff756d63d5ec56408f96a4f707f2f538857cf /gdb/breakpoint.c
parenta4c50be3d68b4f857fee29a45f799755a6862c22 (diff)
downloadgdb-23d6ee640578968b0ddef8e08d7dbb5b558a9ce9.zip
gdb-23d6ee640578968b0ddef8e08d7dbb5b558a9ce9.tar.gz
gdb-23d6ee640578968b0ddef8e08d7dbb5b558a9ce9.tar.bz2
Use unique_xmalloc_ptr in bp_location
This changes struct bp_location to use a unique_xmalloc_ptr, removing a bit of manual memory management.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 477c03b..5c3a6c6 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7192,7 +7192,7 @@ set_breakpoint_location_function (struct bp_location *loc)
find_pc_partial_function (loc->address, &function_name, NULL, NULL);
if (function_name)
- loc->function_name = xstrdup (function_name);
+ loc->function_name = make_unique_xstrdup (function_name);
}
}
@@ -12234,11 +12234,6 @@ say_where (struct breakpoint *b)
}
}
-bp_location::~bp_location ()
-{
- xfree (function_name);
-}
-
/* Destructor for the breakpoint base class. */
breakpoint::~breakpoint ()
@@ -13323,7 +13318,7 @@ ambiguous_names_p (struct bp_location *loc)
for (l = loc; l != NULL; l = l->next)
{
const char **slot;
- const char *name = l->function_name;
+ const char *name = l->function_name.get ();
/* Allow for some names to be NULL, ignore them. */
if (name == NULL)
@@ -13642,7 +13637,8 @@ update_breakpoint_locations (struct breakpoint *b,
{
for (bp_location *l : b->locations ())
if (l->function_name
- && strcmp (e->function_name, l->function_name) == 0)
+ && strcmp (e->function_name.get (),
+ l->function_name.get ()) == 0)
{
l->enabled = e->enabled;
l->disabled_by_cond = e->disabled_by_cond;