toolchain/share/doc/gdb/Guile-Commands.html

105 lines
4.8 KiB
HTML

<html lang="en">
<head>
<title>Guile Commands - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Guile.html#Guile" title="Guile">
<link rel="prev" href="Guile-Introduction.html#Guile-Introduction" title="Guile Introduction">
<link rel="next" href="Guile-API.html#Guile-API" title="Guile API">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Guile-Commands"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Guile-API.html#Guile-API">Guile API</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Guile-Introduction.html#Guile-Introduction">Guile Introduction</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Guile.html#Guile">Guile</a>
<hr>
</div>
<h4 class="subsection">23.3.2 Guile Commands</h4>
<p><a name="index-guile-commands-2450"></a><a name="index-commands-to-access-guile-2451"></a>
<span class="sc">gdb</span> provides two commands for accessing the Guile interpreter:
<a name="index-guile_002drepl-2452"></a>
<a name="index-gr-2453"></a>
<dl><dt><code>guile-repl</code><dt><code>gr</code><dd>The <code>guile-repl</code> command can be used to start an interactive
Guile prompt or <dfn>repl</dfn>. To return to <span class="sc">gdb</span>,
type <kbd>,q</kbd> or the <code>EOF</code> character (e.g., <kbd>Ctrl-D</kbd> on
an empty prompt). These commands do not take any arguments.
<p><a name="index-guile-2454"></a><a name="index-gu-2455"></a><br><dt><code>guile </code><span class="roman">[</span><var>scheme-expression</var><span class="roman">]</span><dt><code>gu </code><span class="roman">[</span><var>scheme-expression</var><span class="roman">]</span><dd>The <code>guile</code> command can be used to evaluate a Scheme expression.
<p>If given an argument, <span class="sc">gdb</span> will pass the argument to the Guile
interpreter for evaluation.
<pre class="smallexample"> (gdb) guile (display (+ 20 3)) (newline)
23
</pre>
<p>The result of the Scheme expression is displayed using normal Guile rules.
<pre class="smallexample"> (gdb) guile (+ 20 3)
23
</pre>
<p>If you do not provide an argument to <code>guile</code>, it will act as a
multi-line command, like <code>define</code>. In this case, the Guile
script is made up of subsequent command lines, given after the
<code>guile</code> command. This command list is terminated using a line
containing <code>end</code>. For example:
<pre class="smallexample"> (gdb) guile
&gt;(display 23)
&gt;(newline)
&gt;end
23
</pre>
</dl>
<p>It is also possible to execute a Guile script from the <span class="sc">gdb</span>
interpreter:
<dl>
<dt><code>source </code><samp><span class="file">script-name</span></samp><dd>The script name must end with &lsquo;<samp><span class="samp">.scm</span></samp>&rsquo; and <span class="sc">gdb</span> must be configured
to recognize the script language based on filename extension using
the <code>script-extension</code> setting. See <a href="Extending-GDB.html#Extending-GDB">Extending GDB</a>.
<br><dt><code>guile (load "script-name")</code><dd>This method uses the <code>load</code> Guile function.
It takes a string argument that is the name of the script to load.
See the Guile documentation for a description of this function.
(see <a href="../guile/Loading.html#Loading">Loading</a>).
</dl>
</body></html>