blob: 63239fea83cfd592269a783587a3881b9b9d7ba0 [file] [log] [blame]
<html lang="en">
<head>
<title>objfile-gdb.py file - 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="Auto_002dloading.html#Auto_002dloading" title="Auto-loading">
<link rel="next" href="_002edebug_005fgdb_005fscripts-section.html#g_t_002edebug_005fgdb_005fscripts-section" title=".debug_gdb_scripts section">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="objfile-gdb.py-file"></a>
<a name="objfile_002dgdb_002epy-file"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="_002edebug_005fgdb_005fscripts-section.html#g_t_002edebug_005fgdb_005fscripts-section">.debug_gdb_scripts section</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>
<hr>
</div>
<h5 class="subsubsection">23.2.3.1 The <samp><var>objfile</var><span class="file">-gdb.py</span></samp> file</h5>
<p><a name="index-g_t_0040file_007b_0040var_007bobjfile_007d_002dgdb_002epy_007d-1947"></a>
When a new object file is read, <span class="sc">gdb</span> looks for
a file named <samp><var>objfile</var><span class="file">-gdb.py</span></samp>,
where <var>objfile</var> is the object file's real name, formed by ensuring
that the file name is absolute, following all symlinks, and resolving
<code>.</code> and <code>..</code> components. If this file exists and is
readable, <span class="sc">gdb</span> will evaluate it as a Python script.
<p>If this file does not exist, and if the parameter
<code>debug-file-directory</code> is set (see <a href="Separate-Debug-Files.html#Separate-Debug-Files">Separate Debug Files</a>),
then <span class="sc">gdb</span> will look for <var>real-name</var> in all of the
directories mentioned in the value of <code>debug-file-directory</code>.
<p>Finally, if this file does not exist, then <span class="sc">gdb</span> will look for
a file named <samp><var>data-directory</var><span class="file">/python/auto-load/</span><var>real-name</var></samp>, where
<var>data-directory</var> is <span class="sc">gdb</span>'s data directory (available via
<code>show data-directory</code>, see <a href="Data-Files.html#Data-Files">Data Files</a>), and <var>real-name</var>
is the object file's real name, as described above.
<p><span class="sc">gdb</span> does not track which files it has already auto-loaded this way.
<span class="sc">gdb</span> will load the associated script every time the corresponding
<var>objfile</var> is opened.
So your <samp><span class="file">-gdb.py</span></samp> file should be careful to avoid errors if it
is evaluated more than once.
</body></html>