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

97 lines
4.7 KiB
HTML

<html lang="en">
<head>
<title>Guile Auto-loading - 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-API.html#Guile-API" title="Guile API">
<link rel="next" href="Guile-Modules.html#Guile-Modules" title="Guile Modules">
<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-Auto-loading"></a>
<a name="Guile-Auto_002dloading"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Guile-Modules.html#Guile-Modules">Guile Modules</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Guile-API.html#Guile-API">Guile API</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Guile.html#Guile">Guile</a>
<hr>
</div>
<h4 class="subsection">23.3.4 Guile Auto-loading</h4>
<p><a name="index-guile-auto_002dloading-2871"></a>
When a new object file is read (for example, due to the <code>file</code>
command, or because the inferior has loaded a shared library),
<span class="sc">gdb</span> will look for Guile support scripts in two ways:
<samp><var>objfile</var><span class="file">-gdb.scm</span></samp> and the <code>.debug_gdb_scripts</code> section.
See <a href="Auto_002dloading-extensions.html#Auto_002dloading-extensions">Auto-loading extensions</a>.
<p>The auto-loading feature is useful for supplying application-specific
debugging commands and scripts.
<p>Auto-loading can be enabled or disabled,
and the list of auto-loaded scripts can be printed.
<dl>
<a name="set-auto_002dload-guile_002dscripts"></a><a name="index-set-auto_002dload-guile_002dscripts-2872"></a><dt><code>set auto-load guile-scripts [on|off]</code><dd>Enable or disable the auto-loading of Guile scripts.
<p><a name="show-auto_002dload-guile_002dscripts"></a><a name="index-show-auto_002dload-guile_002dscripts-2873"></a><br><dt><code>show auto-load guile-scripts</code><dd>Show whether auto-loading of Guile scripts is enabled or disabled.
<p><a name="info-auto_002dload-guile_002dscripts"></a><a name="index-info-auto_002dload-guile_002dscripts-2874"></a><a name="index-print-list-of-auto_002dloaded-Guile-scripts-2875"></a><br><dt><code>info auto-load guile-scripts [</code><var>regexp</var><code>]</code><dd>Print the list of all Guile scripts that <span class="sc">gdb</span> auto-loaded.
<p>Also printed is the list of Guile scripts that were mentioned in
the <code>.debug_gdb_scripts</code> section and were not found.
This is useful because their names are not printed when <span class="sc">gdb</span>
tries to load them and fails. There may be many of them, and printing
an error message for each one is problematic.
<p>If <var>regexp</var> is supplied only Guile scripts with matching names are printed.
<p>Example:
<pre class="smallexample"> (gdb) info auto-load guile-scripts
Loaded Script
Yes scm-section-script.scm
full name: /tmp/scm-section-script.scm
No my-foo-pretty-printers.scm
</pre>
</dl>
<p>When reading an auto-loaded file, <span class="sc">gdb</span> sets the
<dfn>current objfile</dfn>. This is available via the <code>current-objfile</code>
procedure (see <a href="Objfiles-In-Guile.html#Objfiles-In-Guile">Objfiles In Guile</a>). This can be useful for
registering objfile-specific pretty-printers.
</body></html>