diff options
author | Tom Tromey <tromey@adacore.com> | 2020-02-14 09:24:42 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-02-14 12:38:04 -0700 |
commit | 8084e579e114e607cb65482c43566e2c5c844bf6 (patch) | |
tree | c0edbce2fa66e260c02c6d50cc8e9a41a8e7448a /gdb/dwarf2/frame-tailcall.c | |
parent | 07d9838745fa0fcd4e4a92a090bdc467ff12cf0a (diff) | |
download | gdb-8084e579e114e607cb65482c43566e2c5c844bf6.zip gdb-8084e579e114e607cb65482c43566e2c5c844bf6.tar.gz gdb-8084e579e114e607cb65482c43566e2c5c844bf6.tar.bz2 |
Return unique_xmalloc_ptr from call_site_find_chain
call_site_find_chain returns a pointer that the caller must
deallocate. It seemed better here to return a unique_xmalloc_ptr
instead.
gdb/ChangeLog
2020-02-14 Tom Tromey <tromey@adacore.com>
* dwarf2/frame-tailcall.c (dwarf2_tailcall_sniffer_first):
Update.
* dwarf2/loc.h (call_site_find_chain): Return unique_xmalloc_ptr.
* dwarf2/loc.c (call_site_find_chain_1): Return
unique_xmalloc_ptr.
(call_site_find_chain): Likewise.
Diffstat (limited to 'gdb/dwarf2/frame-tailcall.c')
-rw-r--r-- | gdb/dwarf2/frame-tailcall.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gdb/dwarf2/frame-tailcall.c b/gdb/dwarf2/frame-tailcall.c index 3dc300d..2d219f1 100644 --- a/gdb/dwarf2/frame-tailcall.c +++ b/gdb/dwarf2/frame-tailcall.c @@ -368,7 +368,7 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame, int prev_sp_p = 0; CORE_ADDR this_pc; struct gdbarch *prev_gdbarch; - struct call_site_chain *chain = NULL; + gdb::unique_xmalloc_ptr<call_site_chain> chain; struct tailcall_cache *cache; gdb_assert (*tailcall_cachep == NULL); @@ -409,16 +409,13 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame, /* Ambiguous unwind or unambiguous unwind verified as matching. */ if (chain == NULL || chain->length == 0) - { - xfree (chain); - return; - } + return; cache = cache_new_ref1 (this_frame); *tailcall_cachep = cache; - cache->chain = chain; + cache->chain = chain.release (); cache->prev_pc = prev_pc; - cache->chain_levels = pretended_chain_levels (chain); + cache->chain_levels = pretended_chain_levels (cache->chain); cache->prev_sp_p = prev_sp_p; if (cache->prev_sp_p) { |