[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to display parameters in a function backtrace?
From: |
Chet Ramey |
Subject: |
Re: How to display parameters in a function backtrace? |
Date: |
Wed, 2 Feb 2022 10:24:36 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 |
On 2/2/22 9:00 AM, L A Walsh wrote:
> I was trying to find parameters to a function that gave an error, so
> I 'turned on' (included my backtracing routine), which showed:
>
> ./24bc: line 46: printf: `txt=\nRed,': not a valid identifier
> STOPPING execution @ "printf ${_:+-v $_} '\x1b[48;2;%s;%s;%sm' $1 $2 $3" in
> "setBgColor()" at ./24bc #46
> called in setBackBlack() at ./24bc #56
> called in title() at ./24bc #74
> called in main() at ./24bc #81
>
> ----
> I was all, 'rats, its not showing the params', I wondered why and looked at
> the code,
> and realized that while I can backtrace function, source line+file, I didn't
> know how to display the params that were used when the function was called.
Look at BASH_ARGC and BASH_ARGV and how the debugger uses them.
--
``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/