bug-bash
[Top][All Lists]
Advanced

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

Re: Please store source file name + line number for all functions define


From: Chet Ramey
Subject: Re: Please store source file name + line number for all functions defined whether or not bashdb is running.
Date: Sat, 2 Mar 2019 17:29:47 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 3/1/19 11:11 PM, L A Walsh wrote:

> Furthermore, it appears the line numbers may be based on the "reconstituted
> source" rather than the original source.  Either way -- this is why I want
> to be able to turn on storing of the definition from the beginning of the
> login session.

If you mean the function text, I don't think it's of general interest, and
the debugger seems to manage to get along without it. You can get the file
and line number where the function is defined when extdebug is on, even if
you turn it on after the session has begun, and go from there.

> 
> If I add shopt -s extdebug at the beginning of /etc/profile, the correct
> filename and line number are stored and displayed with '-F'.

The filename and line number are always stored.

> 
> As for storing the original source -- for the reasons above.  As a
> safety to allow the debugger to operate under adverse conditions. 

It's not of general enough interest to be worth the implementation cost.
You could try modifying the parser and the input code to do it, if you
were so inclined.

> But 1st, you need to realize that the BASH variables are just as "lost"
> as bashdb.  If source-file and line numbers of definitions are turned on
> from the beginning of a login session, then no matter what function is
> called, it will be known to bash -- and, thus, bashdb -- which can at least
> try to read in the original source.

The filename and line number are always stored. You can turn on extdebug
any time you want to see them.

bash-5.0$ declare -F xtitle
xtitle
bash-5.0$ shopt -s extdebug
bash-5.0$ declare -F xtitle
xtitle 59 /Users/chet/.bashrc
bash-5.0$

It's the same in bash-4.4.

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



reply via email to

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