[PATCH 2/8] Introduce mmap_cache subsystem derived from unwind.c

Dmitry V. Levin ldv at altlinux.org
Mon Feb 26 23:17:45 UTC 2018


On Sat, Jan 27, 2018 at 05:36:38AM +0900, Masatake YAMATO wrote:
> For making mmap cache code reusable from other areas in strace than
> unwind, mmap cache related code and unwind related code should be
> separated.
> 
> This change moves the most of all mmap cache code in unwind.c
> to mmap_cache.c, a new file.
> 
> * Makefile.am (mmap_cache.c): New file.
> * defs.h (mmap_cache_invalidate): Renamed from unwind_cache_invalidate.
> (mmap_cache_delete): Renamed from delete_mmap_cache and extern'ed.
> (mmap_cache_rebuild_if_invalid): Renamed from unwind_cache_invalidate
> and extern'ed.
> (struct mmap_cache_t): Move from unwind.c.
> (enum mmap_cache_rebuild_result): Move from unwind.c.
> * unwind.c: remove mmap_cache implementation.
> * syscall.c: call a function for invalidating mmap cache with new
> name.
[...]
> +		if (tcp->mmap_cache_size >= cur_array_size)
> +			cache_head = xgrowarray(cache_head, &cur_array_size,
> +						sizeof(*cache_head));
> +
> +		entry = &cache_head[tcp->mmap_cache_size];
> +		entry->start_addr = start_addr;
> +		entry->end_addr = end_addr;
> +		entry->mmap_offset = mmap_offset;
> +		entry->binary_filename = xstrdup(binary_path);
> +		tcp->mmap_cache_size++;
> +	}
> +	fclose(fp);
> +	tcp->mmap_cache = cache_head;
> +	tcp->mmap_cache_generation = mmap_cache_generation;

With this change the code that accesses tcp->mmap_* fields is compiled
unconditionally while the definition of these fields is still depends on
[USE_LIBUNWIND].  As result, strace no longer builds without libunwind.

I'll amend this patch to fix the build, but next time please check that
--without-libunwind builds and works with your changes.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180227/4d7198ce/attachment.bin>


More information about the Strace-devel mailing list