backtrace.3: Minor reworking in example program

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-02-29 23:16:38 +01:00
parent bf92bef9c9
commit cefcfd92d5
1 changed files with 4 additions and 3 deletions

View File

@ -211,15 +211,16 @@ backtrace() returned 8 addresses
#include <stdlib.h>
#include <unistd.h>
#define BT_BUF_SIZE 100
void
myfunc3(void)
{
int j, nptrs;
const int SIZE = 100;
void *buffer[SIZE];
void *buffer[BT_BUF_SIZE];
char **strings;
nptrs = backtrace(buffer, SIZE);
nptrs = backtrace(buffer, BT_BUF_SIZE);
printf("backtrace() returned %d addresses\\n", nptrs);
/* The call backtrace_symbols_fd(buffer, nptrs, STDOUT_FILENO)