LINUX.ORG.RU

История изменений

Исправление cumvillain, (текущая версия) :

Ну его даже gdb умеет, г-ди:

$ cat test.c                                       
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	int n = 10;
	int a[n];

	printf("sizeof (a) = %zu\n", sizeof(a));
	abort();
	return 0;
}
$ gcc -std=c11 -ggdb -o test test.c
$ ./test 
sizeof (a) = 40
zsh: IOT instruction (core dumped)  ./test
$ coredumpctl debug -A "-batch -ex 'frame 3' -ex 'print a'" 
[...]
Program terminated with signal SIGABRT, Aborted.
#0  0x00007ba239a6f32c in ?? () from /usr/lib/libc.so.6
#3  0x00005ab569f251d6 in main () at test.c:11
11		abort();
$1 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Исходная версия cumvillain, :

Ну его даже gdb умеет, г-ди:

$ cat test.c                             
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	int n = 10;
	int a[n];

$ cat test.c                                       
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	int n = 10;
	int a[n];

	printf("sizeof (a) = %zu\n", sizeof(a));
	abort();
	return 0;
}
$ gcc -std=c11 -ggdb -o test test.c
$ ./test 
sizeof (a) = 40
zsh: IOT instruction (core dumped)  ./test
$ coredumpctl debug -A "-batch -ex 'frame 3' -ex 'print a'" 
[...]
Program terminated with signal SIGABRT, Aborted.
#0  0x00007ba239a6f32c in ?? () from /usr/lib/libc.so.6
#3  0x00005ab569f251d6 in main () at test.c:11
11		abort();
$1 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}