bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: turning on file+line for functions with shopt -s extdebug gives erro


From: Chet Ramey
Subject: Re: turning on file+line for functions with shopt -s extdebug gives error
Date: Fri, 1 Mar 2019 11:00:41 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 2/27/19 4:19 PM, L A Walsh wrote:

>>> Are they defined "somewhere"?  Maybe a short note as to what they
>>> are might be added to the manpage where the terms are used (under
>>> description of shopt+extdebug)?
>>>     
>>
>> They're described in the FUNCTIONS section, since they affect function
>> behavior...
>>
>> 5.     Function tracing is  enabled:  command  substitu-
>>        tion, shell functions, and subshells invoked with
>>        ( command ) inherit the DEBUG and RETURN traps.
>> 6.     Error tracing is enabled:  command  substitution,
>>        shell  functions,  and  subshells  invoked with (
>>        command ) inherit the ERR trap.
>>
>> To be clear, you're suggesting that I add something to the `extdebug'
>> section to explain how these features can be enabled separately from
>> `extdebug'?
> ----
>  
>   Not exactly, just that "set -o func/errtrace and -T/-F are under "set".
> 
>   A "forward pointer" to the behavior described under 'shopt-extdebug'
> would be useful.  If you are reading from top to bottom, something
> under "set-T" saying:
> 
>      "SEE ALSO, behavior description under 'shopt-extdebug', below"

Why? The description of the behavior is identical in both cases. If
anything, the description of extdebug should note that it is possible
to get the functrace and errtrace behaviors independently, and that's
a back reference.


>    More important than the doc forward-definition suggestion, is the
> ability for bash to toggle behaviors independent of invoking the
> debugger (From (On 2/26/2019 4:26 PM, L A Walsh wrote:), reposting:)
> 
> The part about turning on filenames+line numbers for function definitions
> is in bash.  If those aren't on, the debugger can't find them.

BASH_SOURCE and BASH_LINENO are available even when the debugger is
not running, as is the `caller' builtin. The declare -F stuff is not,
but I don't see that as generally useful outside the debugger.

> Also, the desire to retain the original source format of code is another
> "in bash" issue.  Perhaps it could be tied or related to the turning on
> of function definition locations.
The debugger goes back to the original source file to find the function
definitions, doesn't it? It's wasteful and not particularly useful to have
the function definition text stored internally when you can regenerate an
equivalent form from the compiled function definition.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]