Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Eli Zaretskii <eliz@elta.co.il>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch/rfc, rfa:doco, 6.0] "set backtrace past-main|limit"
Date: Mon, 04 Aug 2003 13:17:00 -0000	[thread overview]
Message-ID: <3F2E5CD7.6010403@redhat.com> (raw)
In-Reply-To: <ullubs262.fsf@elta.co.il>

>> Date: Sat, 02 Aug 2003 19:16:18 -0400
>> From: Andrew Cagney <ac131313@redhat.com>
>> 
>> This patch replaces the commands:
>> 
>> 	set/show backtrace-below-main
>> 	show backtrace-below-main
>> 
>> with the pair of commands:
>> 
>> 	set/show backtrace past-main
>> 	set/show backtrace limit
> 
> 
> I'm not sure I like what happens when the backtrace is deeper than
> the limit:
> 
> 
>> +  if (this_frame->level > backtrace_limit)
>> +    {
>> +      error ("Backtrace limit of %d exceeded", backtrace_limit);
>> +    }
>> +
> 
> 
> Why should this be anything as scary as `error'?  Isn't a simple
> notice (not even a `warning') enough?

The choices I could think of were:

- warn and return NULL
but that would become tedious as it would keep occuring - get_prev_frame 
is called many times.

- error out
perhaps add additional information on how to change the limit

- warn and continue the backtrace
I don't think this helps

The difference between a warning and error are largely internal - the 
latter aborts the command and I think that's better here.

>> where the latter sets an absolute bound on the number of backtraces. 
>> 10000 (arbitrary) by default.
> 
> 
> The 10000 default limit is not backward-compatible.  Why not just
> leave it at zero, as that's how GDB behaves today?

(Zero gets turned into MAX_INT)

True, the problem I encountered was in the testsuite.  That could always 
be modified to, by default, set an upper bound.

> If we do set the limit by default to some number, that number should
> at least be documented in the manual.

There are a number of constants like that.  There should be a more 
robust way of keeping them consistent between the doco and the code. 
However defaulting it to infinite would avoid the problem.

>> eli, the doco ok?
> 
> 
> Yes, but...
> 
> 
>> +If you need to examine the startup code, or limit the number of levels
>> +in a backtrace, you can change this behavior:
>>  
>>  @table @code
>> -@item set backtrace-below-main off
>> +@item set backtrace past-main off
>>  Backtraces will stop when they encounter the user entry point.  This is the
>>  default.
> 
> 
> I think it's better to put "@itemx set backtrace past-main on" first,
> and "@item set backtrace past-main off" second, because otherwise the
> above fragment of text doesn't make sense: you tell the reader that
> the default behavior can be changed, but then show them the command
> that sets the default behavior.

I'll switch the order (which came from the old doco :-).

>> +@item set backtrace limit @var{number}
>> +@itemx set backtrace limit 0
>> +Limit the the backtrace to @var{number} levels.  A value of zero means
>> +unlimited.
> 
> 
> I suggest a "@cindex backtrace limit" here.  That way, someone who
> types "backtrace" in an Info reader and then hits TAB, will see this
> item in the list of possible completions.
> 
> Also, isn't it better to use "n" instead of "number" here?  It seems
> to me that
> 
>   Limit the backtrace to N levels
> 
> sounds better in English than
> 
>   Limit the backtrace to NUMBER levels
> 
> Do you agree?

Yep.  I was wondering what @var{} to use there.

> Finally, note the two consecutive "the" before "backtrace"; a typo.
> 
> Otherwise, this docs change is okay; thanks.

Thanks.  Lets see if there are any other comments on limit's default.

Andrew





  reply	other threads:[~2003-08-04 13:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-02 23:16 Andrew Cagney
2003-08-03  6:02 ` Eli Zaretskii
2003-08-04 13:17   ` Andrew Cagney [this message]
2003-08-04 15:23     ` Eli Zaretskii
2003-08-04 15:59       ` Andrew Cagney
2003-08-07 22:05       ` Andrew Cagney
2003-08-08  7:34         ` Eli Zaretskii
2003-08-09 15:07           ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F2E5CD7.6010403@redhat.com \
    --to=ac131313@redhat.com \
    --cc=eliz@elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox