[PATCH 3/4] ldv/unwind: handle deleted file when building map cache

Dmitry V. Levin ldv at altlinux.org
Thu Apr 10 23:26:38 UTC 2014


On Thu, Apr 10, 2014 at 01:52:11AM +0900, Masatake YAMATO wrote:
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
> ---
>  unwind.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/unwind.c b/unwind.c
> index a7e985e..0f9f79d 100644
> --- a/unwind.c
> +++ b/unwind.c
> @@ -130,6 +130,7 @@ build_mmap_cache(struct tcb *tcp)
>  	char filename[sizeof ("/proc/0123456789/maps")];
>  	char buffer[PATH_MAX + 80];
>  	char binary_path[PATH_MAX];
> +	size_t blen;
>  	struct mmap_cache_t *cur_entry, *prev_entry;
>  	/* start with a small dynamically-allocated array and then expand it */
>  	size_t cur_array_size = 10;
> @@ -162,6 +163,11 @@ build_mmap_cache(struct tcb *tcp)
>  		if (binary_path[0] == '\0')
>  			continue;
>  
> +		/* ignore deleted file. */
> +		blen = strlen(binary_path);
> +		if (blen >= 10 && strcmp(binary_path + blen - 10, " (deleted)") == 0)
> +			continue;
> +

First of all, please do not hardcode magic numbers.
If you mean strlen("(deleted)"), just write it.

Second, why deleted files should be excluded from stack trace?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140411/91aa2787/attachment.bin>


More information about the Strace-devel mailing list