[Tarantool-patches] [PATCH v2 4/4] fiber: refactor C backtrace and add changelog
Egor Elchinov
eelchinov at tarantool.org
Wed Jul 14 12:42:54 MSK 2021
On 12.07.2021 15:35, Cyrill Gorcunov via Tarantool-patches wrote:
> On Fri, Jul 09, 2021 at 02:03:53PM +0300, Egor Elchinov via Tarantool-patches wrote:
>> +
>> +int
>> +backtrace_proc_cache_put(unw_word_t ip, const char *name, unw_word_t offset)
>> +{
>> struct proc_cache_entry *entry;
>> struct mh_i64ptr_node_t node;
>> mh_int_t k;
>> @@ -99,39 +108,51 @@ get_proc_name(unw_cursor_t *unw_cur, unw_word_t *offset, bool skip_cache)
>> if (proc_cache == NULL) {
>> region_create(&cache_region, &cord()->slabc);
>> proc_cache = mh_i64ptr_new();
>> - if (proc_cache == NULL) {
>> - unw_get_proc_name(unw_cur, proc_name, sizeof(proc_name),
>> - offset);
>> - goto error;
>> - }
>> + if (proc_cache == NULL)
>> + return -1;
>> + }
>> +
>> + size_t size;
>> + entry = region_alloc_object(&cache_region, typeof(*entry),
>> + &size);
>> + if (entry == NULL)
>> + return -1;
>> +
>> + node.key = ip;
>> + node.val = entry;
>> + entry->offset = offset;
>> + snprintf(entry->name, BACKTRACE_NAME_MAX, "%s", name);
>
> Please add
>
> entry->name[BACKTRACE_NAME_MAX - 1] = 0;
>
Thanks, fixed.
> ...
>
> The rest looks ok to me, thanks!
>
More information about the Tarantool-patches
mailing list