[minicoredumper] [PATCH] Read the stack pointer from the 28th field of /proc/PID/stat

Łukasz Stelmach l.stelmach at samsung.com
Fri Jan 5 14:02:53 CET 2018


It was <2018-01-03 śro 18:56>, when Łukasz Stelmach wrote:
> According to the current version of the official manpage[1] the stack
> pointer is the 28th field.
>
> [1] https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man5/proc.5?id=2468f14e4b4cfb74f7661ef7f488ef5f0e51f61d#n2065
>
> Signed-off-by: Łukasz Stelmach <l.stelmach at samsung.com>
> ---
>  src/minicoredumper/corestripper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/minicoredumper/corestripper.c b/src/minicoredumper/corestripper.c
> index 11e0df1..870e175 100644
> --- a/src/minicoredumper/corestripper.c
> +++ b/src/minicoredumper/corestripper.c
> @@ -1930,9 +1930,9 @@ static int get_stack_pointer(pid_t pid, unsigned long *addr)
>  	if (fgets(buf, STAT_LINE_MAXSIZE, f) == NULL)
>  		goto out_err;
>  
> -	/* find 29th item: man proc(5) */
> +	/* find 28th item: man proc(5) */
>  	p = buf;
> -	for (i = 0; i < 28; i++) {
> +	for (i = 0; i < 27; i++) {
>  		p = strchr(p, ' ');
>  		if (!p)
>  			goto out_err;

The patch is wrong. It should be 29th field, but since Linix v4.9
(commit 0a1eb2d4 precisely) esp and eip values has been set to 0 in the
stat file. I am working around this problem.

-- 
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/minicoredumper/attachments/20180105/d857324c/attachment.sig>


More information about the minicoredumper mailing list