diff options
author | Mark Wielaard <mjw@redhat.com> | 2014-01-27 16:05:54 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2014-01-27 16:05:54 +0100 |
commit | 8520f70163866b64f8e9822972dd9c26151455ea (patch) | |
tree | 0fb09a8696dc4531490beee863b242b8cad2d9da | |
parent | 531a30acbe175da1f71768e2ffb585c4d45e640b (diff) | |
download | elfutils-8520f70163866b64f8e9822972dd9c26151455ea.tar.gz |
stack: Initialize -n maxframes to 256 by default.
Make -n default just 256 frames, 2048 was too big. Also Document magic
number used in frames.allocated initialization.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/stack.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 143d73cc..d1b221f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-01-27 Mark Wielaard <mjw@redhat.com> + + * stack.c (maxframes): Initialize to 256. + (main): Document new default in options. Document magic number + used in frames.allocated initialization. + 2014-01-20 Mark Wielaard <mjw@redhat.com> * stack.c (show_debugname): New static boolean. diff --git a/src/stack.c b/src/stack.c index ae0ef126..e675267d 100644 --- a/src/stack.c +++ b/src/stack.c @@ -52,7 +52,7 @@ static bool show_raw = false; static bool show_modules = false; static bool show_debugname = false; -static int maxframes = 2048; +static int maxframes = 256; struct frame { @@ -571,7 +571,7 @@ main (int argc, char **argv) { NULL, '1', NULL, 0, N_("Show the backtrace of only one thread"), 0 }, { NULL, 'n', "MAXFRAMES", 0, - N_("Show at most MAXFRAMES per thread (default 2048, use 0 for unlimited)"), 0 }, + N_("Show at most MAXFRAMES per thread (default 256, use 0 for unlimited)"), 0 }, { "list-modules", 'l', NULL, 0, N_("Show module memory map with build-id, elf and debug files detected"), 0 }, { NULL, 0, NULL, 0, NULL, 0 } @@ -601,6 +601,8 @@ invoked with bad or missing arguments it will exit with return code 64.") } struct frames frames; + /* When maxframes is zero, then 2048 is just the initial allocation + that will be increased using realloc in framecallback (). */ frames.allocated = maxframes == 0 ? 2048 : maxframes; frames.frames = 0; frames.frame = malloc (sizeof (struct frame) * frames.allocated); |