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

Łukasz Stelmach l.stelmach at samsung.com
Wed Jan 3 18:56:43 CET 2018


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;
-- 
2.11.0




More information about the minicoredumper mailing list