[minicoredumper] gdb corrupt stack

Marco.Felsch at preh.de Marco.Felsch at preh.de
Wed Jul 5 12:11:59 CEST 2017


On 03.07.2017 17:06, Marco.Felsch at preh.de wrote:
> Hi,
> 
> I had cross compiled the minicoredumper for the aarch64.
> Generating the core file works fine but analyze the the core file with gdb on a remote host isn't possible.
> 
> I only want a small core file to show the backtrace within gdb.
> I am able to show the top most (#0/#1) backtrace entries but no more.

After some debugging I found the problem. Since linux-v4.9 it is not 
possible to get the stack from the /proc/stat file system since commit 
0a1eb2d47 [0].

So the below code should be changed to use ptrace:

	/* find 29th item: man proc(5) */
	p = buf;
	for (i = 0; i < 28; i++) {
		p = strchr(p, ' ');
		if (!p)
			goto out_err;
		p++;
	}

	/* read stack pointer */
	if (sscanf(p, "%lu ", addr) != 1)
		goto out_err;

Marco Felsch


[0] 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/fs/proc/array.c?h=linux-4.9.y&id=0a1eb2d474edfe75466be6b4677ad84e5e8ca3f5 


More information about the minicoredumper mailing list