docs: Mention --profile

This commit is contained in:
Fabian Boehm 2022-10-23 13:42:35 +02:00
parent 4001e2fe19
commit 23b5390a0c

View file

@ -1789,3 +1789,5 @@ Debugging fish scripts
Fish includes a built-in debugging facility. The debugger allows you to stop execution of a script at an arbitrary point. When this happens you are presented with an interactive prompt. At this prompt you can execute any fish command (there are no debug commands as such). For example, you can check or change the value of any variables using :doc:`printf <cmds/printf>` and :doc:`set <cmds/set>`. As another example, you can run :doc:`status print-stack-trace <cmds/status>` to see how this breakpoint was reached. To resume normal execution of the script, simply type :doc:`exit <cmds/exit>` or :kbd:`Control`\ +\ :kbd:`D`.
To start a debug session simply run the builtin command :doc:`breakpoint <cmds/breakpoint>` at the point in a function or script where you wish to gain control. Also, the default action of the TRAP signal is to call this builtin. So a running script can be debugged by sending it the TRAP signal with the ``kill`` command. Once in the debugger, it is easy to insert new breakpoints by using the funced function to edit the definition of a function.
If you want to debug performance, specifically, :program:`fish` can be told to save a profile via the ``--profile /path/to/file`` option. See :doc:`fish <cmds/fish>` for more.