| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <!-- This file documents the BFD library. |
| |
| Copyright (C) 1991 - 2013 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 "GNU General Public License" and "Funding |
| Free Software", the Front-Cover texts being (a) (see below), and with |
| the Back-Cover Texts being (b) (see below). A copy of the license is |
| included in the section entitled "GNU Free Documentation License". |
| |
| (a) The FSF's Front-Cover Text is: |
| |
| A GNU Manual |
| |
| (b) The FSF's Back-Cover Text is: |
| |
| You have freedom to copy and modify this GNU Manual, like GNU |
| software. Copies published by the Free Software Foundation raise |
| funds for GNU development. --> |
| <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ --> |
| <head> |
| <title>Untitled Document: Opening and Closing</title> |
| |
| <meta name="description" content="Untitled Document: Opening and Closing"> |
| <meta name="keywords" content="Untitled Document: Opening and Closing"> |
| <meta name="resource-type" content="document"> |
| <meta name="distribution" content="global"> |
| <meta name="Generator" content="makeinfo"> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <link href="index.html#Top" rel="start" title="Top"> |
| <link href="BFD-Index.html#BFD-Index" rel="index" title="BFD Index"> |
| <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| <link href="BFD-front-end.html#BFD-front-end" rel="up" title="BFD front end"> |
| <link href="Internal.html#Internal" rel="next" title="Internal"> |
| <link href="Architectures.html#Architectures" rel="prev" title="Architectures"> |
| <style type="text/css"> |
| <!-- |
| a.summary-letter {text-decoration: none} |
| blockquote.smallquotation {font-size: smaller} |
| div.display {margin-left: 3.2em} |
| div.example {margin-left: 3.2em} |
| div.indentedblock {margin-left: 3.2em} |
| div.lisp {margin-left: 3.2em} |
| div.smalldisplay {margin-left: 3.2em} |
| div.smallexample {margin-left: 3.2em} |
| div.smallindentedblock {margin-left: 3.2em; font-size: smaller} |
| div.smalllisp {margin-left: 3.2em} |
| kbd {font-style:oblique} |
| pre.display {font-family: inherit} |
| pre.format {font-family: inherit} |
| pre.menu-comment {font-family: serif} |
| pre.menu-preformatted {font-family: serif} |
| pre.smalldisplay {font-family: inherit; font-size: smaller} |
| pre.smallexample {font-size: smaller} |
| pre.smallformat {font-family: inherit; font-size: smaller} |
| pre.smalllisp {font-size: smaller} |
| span.nocodebreak {white-space:nowrap} |
| span.nolinebreak {white-space:nowrap} |
| span.roman {font-family:serif; font-weight:normal} |
| span.sansserif {font-family:sans-serif; font-weight:normal} |
| ul.no-bullet {list-style: none} |
| --> |
| </style> |
| |
| |
| </head> |
| |
| <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> |
| <a name="Opening-and-Closing"></a> |
| <div class="header"> |
| <p> |
| Next: <a href="Internal.html#Internal" accesskey="n" rel="next">Internal</a>, Previous: <a href="Architectures.html#Architectures" accesskey="p" rel="prev">Architectures</a>, Up: <a href="BFD-front-end.html#BFD-front-end" accesskey="u" rel="up">BFD front end</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p> |
| </div> |
| <hr> |
| |
| <div class="example"> |
| <pre class="example">/* Set to N to open the next N BFDs using an alternate id space. */ |
| extern unsigned int bfd_use_reserved_id; |
| </pre></div> |
| <a name="Opening-and-closing-BFDs"></a> |
| <h3 class="section">2.14 Opening and closing BFDs</h3> |
| |
| |
| <a name="Functions-for-opening-and-closing"></a> |
| <h4 class="subsection">2.14.1 Functions for opening and closing</h4> |
| |
| |
| <a name="index-bfd_005ffopen"></a> |
| <a name="bfd_005ffopen"></a> |
| <h4 class="subsubsection">2.14.1.1 <code>bfd_fopen</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd *bfd_fopen (const char *filename, const char *target, |
| const char *mode, int fd); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Open the file <var>filename</var> with the target <var>target</var>. |
| Return a pointer to the created BFD. If <var>fd</var> is not -1, |
| then <code>fdopen</code> is used to open the file; otherwise, <code>fopen</code> |
| is used. <var>mode</var> is passed directly to <code>fopen</code> or |
| <code>fdopen</code>. |
| </p> |
| <p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by |
| that function. |
| </p> |
| <p>The new BFD is marked as cacheable iff <var>fd</var> is -1. |
| </p> |
| <p>If <code>NULL</code> is returned then an error has occured. Possible errors |
| are <code>bfd_error_no_memory</code>, <code>bfd_error_invalid_target</code> or |
| <code>system_call</code> error. |
| </p> |
| <p>On error, <var>fd</var> is always closed. |
| </p> |
| <a name="index-bfd_005fopenr"></a> |
| <a name="bfd_005fopenr"></a> |
| <h4 class="subsubsection">2.14.1.2 <code>bfd_openr</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd *bfd_openr (const char *filename, const char *target); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Open the file <var>filename</var> (using <code>fopen</code>) with the target |
| <var>target</var>. Return a pointer to the created BFD. |
| </p> |
| <p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by |
| that function. |
| </p> |
| <p>If <code>NULL</code> is returned then an error has occured. Possible errors |
| are <code>bfd_error_no_memory</code>, <code>bfd_error_invalid_target</code> or |
| <code>system_call</code> error. |
| </p> |
| <a name="index-bfd_005ffdopenr"></a> |
| <a name="bfd_005ffdopenr"></a> |
| <h4 class="subsubsection">2.14.1.3 <code>bfd_fdopenr</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd *bfd_fdopenr (const char *filename, const char *target, int fd); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| <code>bfd_fdopenr</code> is to <code>bfd_fopenr</code> much like <code>fdopen</code> is to |
| <code>fopen</code>. It opens a BFD on a file already described by the |
| <var>fd</var> supplied. |
| </p> |
| <p>When the file is later <code>bfd_close</code>d, the file descriptor will |
| be closed. If the caller desires that this file descriptor be |
| cached by BFD (opened as needed, closed as needed to free |
| descriptors for other opens), with the supplied <var>fd</var> used as |
| an initial file descriptor (but subject to closure at any time), |
| call bfd_set_cacheable(bfd, 1) on the returned BFD. The default |
| is to assume no caching; the file descriptor will remain open |
| until <code>bfd_close</code>, and will not be affected by BFD operations |
| on other files. |
| </p> |
| <p>Possible errors are <code>bfd_error_no_memory</code>, |
| <code>bfd_error_invalid_target</code> and <code>bfd_error_system_call</code>. |
| </p> |
| <p>On error, <var>fd</var> is closed. |
| </p> |
| <a name="index-bfd_005fopenstreamr"></a> |
| <a name="bfd_005fopenstreamr"></a> |
| <h4 class="subsubsection">2.14.1.4 <code>bfd_openstreamr</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd *bfd_openstreamr (const char *, const char *, void *); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Open a BFD for read access on an existing stdio stream. When |
| the BFD is passed to <code>bfd_close</code>, the stream will be closed. |
| </p> |
| <a name="index-bfd_005fopenr_005fiovec"></a> |
| <a name="bfd_005fopenr_005fiovec"></a> |
| <h4 class="subsubsection">2.14.1.5 <code>bfd_openr_iovec</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd *bfd_openr_iovec (const char *filename, const char *target, |
| void *(*open_func) (struct bfd *nbfd, |
| void *open_closure), |
| void *open_closure, |
| file_ptr (*pread_func) (struct bfd *nbfd, |
| void *stream, |
| void *buf, |
| file_ptr nbytes, |
| file_ptr offset), |
| int (*close_func) (struct bfd *nbfd, |
| void *stream), |
| int (*stat_func) (struct bfd *abfd, |
| void *stream, |
| struct stat *sb)); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Create and return a BFD backed by a read-only <var>stream</var>. |
| The <var>stream</var> is created using <var>open_func</var>, accessed using |
| <var>pread_func</var> and destroyed using <var>close_func</var>. |
| </p> |
| <p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by |
| that function. |
| </p> |
| <p>Calls <var>open_func</var> (which can call <code>bfd_zalloc</code> and |
| <code>bfd_get_filename</code>) to obtain the read-only stream backing |
| the BFD. <var>open_func</var> either succeeds returning the |
| non-<code>NULL</code> <var>stream</var>, or fails returning <code>NULL</code> |
| (setting <code>bfd_error</code>). |
| </p> |
| <p>Calls <var>pread_func</var> to request <var>nbytes</var> of data from |
| <var>stream</var> starting at <var>offset</var> (e.g., via a call to |
| <code>bfd_read</code>). <var>pread_func</var> either succeeds returning the |
| number of bytes read (which can be less than <var>nbytes</var> when |
| end-of-file), or fails returning -1 (setting <code>bfd_error</code>). |
| </p> |
| <p>Calls <var>close_func</var> when the BFD is later closed using |
| <code>bfd_close</code>. <var>close_func</var> either succeeds returning 0, or |
| fails returning -1 (setting <code>bfd_error</code>). |
| </p> |
| <p>Calls <var>stat_func</var> to fill in a stat structure for bfd_stat, |
| bfd_get_size, and bfd_get_mtime calls. <var>stat_func</var> returns 0 |
| on success, or returns -1 on failure (setting <code>bfd_error</code>). |
| </p> |
| <p>If <code>bfd_openr_iovec</code> returns <code>NULL</code> then an error has |
| occurred. Possible errors are <code>bfd_error_no_memory</code>, |
| <code>bfd_error_invalid_target</code> and <code>bfd_error_system_call</code>. |
| </p> |
| <a name="index-bfd_005fopenw"></a> |
| <a name="bfd_005fopenw"></a> |
| <h4 class="subsubsection">2.14.1.6 <code>bfd_openw</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd *bfd_openw (const char *filename, const char *target); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Create a BFD, associated with file <var>filename</var>, using the |
| file format <var>target</var>, and return a pointer to it. |
| </p> |
| <p>Possible errors are <code>bfd_error_system_call</code>, <code>bfd_error_no_memory</code>, |
| <code>bfd_error_invalid_target</code>. |
| </p> |
| <a name="index-bfd_005fclose"></a> |
| <a name="bfd_005fclose"></a> |
| <h4 class="subsubsection">2.14.1.7 <code>bfd_close</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd_boolean bfd_close (bfd *abfd); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Close a BFD. If the BFD was open for writing, then pending |
| operations are completed and the file written out and closed. |
| If the created file is executable, then <code>chmod</code> is called |
| to mark it as such. |
| </p> |
| <p>All memory attached to the BFD is released. |
| </p> |
| <p>The file descriptor associated with the BFD is closed (even |
| if it was passed in to BFD by <code>bfd_fdopenr</code>). |
| </p> |
| <p><strong>Returns</strong><br> |
| <code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>. |
| </p> |
| <a name="index-bfd_005fclose_005fall_005fdone"></a> |
| <a name="bfd_005fclose_005fall_005fdone"></a> |
| <h4 class="subsubsection">2.14.1.8 <code>bfd_close_all_done</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd_boolean bfd_close_all_done (bfd *); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Close a BFD. Differs from <code>bfd_close</code> since it does not |
| complete any pending operations. This routine would be used |
| if the application had just used BFD for swapping and didn’t |
| want to use any of the writing code. |
| </p> |
| <p>If the created file is executable, then <code>chmod</code> is called |
| to mark it as such. |
| </p> |
| <p>All memory attached to the BFD is released. |
| </p> |
| <p><strong>Returns</strong><br> |
| <code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>. |
| </p> |
| <a name="index-bfd_005fcreate"></a> |
| <a name="bfd_005fcreate"></a> |
| <h4 class="subsubsection">2.14.1.9 <code>bfd_create</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd *bfd_create (const char *filename, bfd *templ); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Create a new BFD in the manner of <code>bfd_openw</code>, but without |
| opening a file. The new BFD takes the target from the target |
| used by <var>templ</var>. The format is always set to <code>bfd_object</code>. |
| </p> |
| <a name="index-bfd_005fmake_005fwritable"></a> |
| <a name="bfd_005fmake_005fwritable"></a> |
| <h4 class="subsubsection">2.14.1.10 <code>bfd_make_writable</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd_boolean bfd_make_writable (bfd *abfd); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Takes a BFD as created by <code>bfd_create</code> and converts it |
| into one like as returned by <code>bfd_openw</code>. It does this |
| by converting the BFD to BFD_IN_MEMORY. It’s assumed that |
| you will call <code>bfd_make_readable</code> on this bfd later. |
| </p> |
| <p><strong>Returns</strong><br> |
| <code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>. |
| </p> |
| <a name="index-bfd_005fmake_005freadable"></a> |
| <a name="bfd_005fmake_005freadable"></a> |
| <h4 class="subsubsection">2.14.1.11 <code>bfd_make_readable</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd_boolean bfd_make_readable (bfd *abfd); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Takes a BFD as created by <code>bfd_create</code> and |
| <code>bfd_make_writable</code> and converts it into one like as |
| returned by <code>bfd_openr</code>. It does this by writing the |
| contents out to the memory buffer, then reversing the |
| direction. |
| </p> |
| <p><strong>Returns</strong><br> |
| <code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>. |
| </p> |
| <a name="index-bfd_005falloc"></a> |
| <a name="bfd_005falloc"></a> |
| <h4 class="subsubsection">2.14.1.12 <code>bfd_alloc</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">void *bfd_alloc (bfd *abfd, bfd_size_type wanted); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Allocate a block of <var>wanted</var> bytes of memory attached to |
| <code>abfd</code> and return a pointer to it. |
| </p> |
| <a name="index-bfd_005falloc2"></a> |
| <a name="bfd_005falloc2"></a> |
| <h4 class="subsubsection">2.14.1.13 <code>bfd_alloc2</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Allocate a block of <var>nmemb</var> elements of <var>size</var> bytes each |
| of memory attached to <code>abfd</code> and return a pointer to it. |
| </p> |
| <a name="index-bfd_005fzalloc"></a> |
| <a name="bfd_005fzalloc"></a> |
| <h4 class="subsubsection">2.14.1.14 <code>bfd_zalloc</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">void *bfd_zalloc (bfd *abfd, bfd_size_type wanted); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Allocate a block of <var>wanted</var> bytes of zeroed memory |
| attached to <code>abfd</code> and return a pointer to it. |
| </p> |
| <a name="index-bfd_005fzalloc2"></a> |
| <a name="bfd_005fzalloc2"></a> |
| <h4 class="subsubsection">2.14.1.15 <code>bfd_zalloc2</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Allocate a block of <var>nmemb</var> elements of <var>size</var> bytes each |
| of zeroed memory attached to <code>abfd</code> and return a pointer to it. |
| </p> |
| <a name="index-bfd_005fcalc_005fgnu_005fdebuglink_005fcrc32"></a> |
| <a name="bfd_005fcalc_005fgnu_005fdebuglink_005fcrc32"></a> |
| <h4 class="subsubsection">2.14.1.16 <code>bfd_calc_gnu_debuglink_crc32</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">unsigned long bfd_calc_gnu_debuglink_crc32 |
| (unsigned long crc, const unsigned char *buf, bfd_size_type len); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Computes a CRC value as used in the .gnu_debuglink section. |
| Advances the previously computed <var>crc</var> value by computing |
| and adding in the crc32 for <var>len</var> bytes of <var>buf</var>. |
| </p> |
| <p><strong>Returns</strong><br> |
| Return the updated CRC32 value. |
| </p> |
| <a name="index-bfd_005fget_005fdebug_005flink_005finfo"></a> |
| <a name="bfd_005fget_005fdebug_005flink_005finfo"></a> |
| <h4 class="subsubsection">2.14.1.17 <code>bfd_get_debug_link_info</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">char *bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| fetch the filename and CRC32 value for any separate debuginfo |
| associated with <var>abfd</var>. Return NULL if no such info found, |
| otherwise return filename and update <var>crc32_out</var>. The |
| returned filename is allocated with <code>malloc</code>; freeing it |
| is the responsibility of the caller. |
| </p> |
| <a name="index-bfd_005fget_005falt_005fdebug_005flink_005finfo"></a> |
| <a name="bfd_005fget_005falt_005fdebug_005flink_005finfo"></a> |
| <h4 class="subsubsection">2.14.1.18 <code>bfd_get_alt_debug_link_info</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">char *bfd_get_alt_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Fetch the filename and BuildID value for any alternate debuginfo |
| associated with <var>abfd</var>. Return NULL if no such info found, |
| otherwise return filename and update <var>buildid_out</var>. The |
| returned filename is allocated with <code>malloc</code>; freeing it |
| is the responsibility of the caller. |
| </p> |
| <a name="index-separate_005fdebug_005ffile_005fexists"></a> |
| <a name="separate_005fdebug_005ffile_005fexists"></a> |
| <h4 class="subsubsection">2.14.1.19 <code>separate_debug_file_exists</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd_boolean separate_debug_file_exists |
| (char *name, unsigned long crc32); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Checks to see if <var>name</var> is a file and if its contents |
| match <var>crc32</var>. |
| </p> |
| <a name="index-separate_005falt_005fdebug_005ffile_005fexists"></a> |
| <a name="separate_005falt_005fdebug_005ffile_005fexists"></a> |
| <h4 class="subsubsection">2.14.1.20 <code>separate_alt_debug_file_exists</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd_boolean separate_alt_debug_file_exists |
| (char *name, unsigned long crc32); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Checks to see if <var>name</var> is a file and if its BuildID |
| matches <var>buildid</var>. |
| </p> |
| <a name="index-find_005fseparate_005fdebug_005ffile"></a> |
| <a name="find_005fseparate_005fdebug_005ffile"></a> |
| <h4 class="subsubsection">2.14.1.21 <code>find_separate_debug_file</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">char *find_separate_debug_file (bfd *abfd); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Searches <var>abfd</var> for a section called <var>section_name</var> which |
| is expected to contain a reference to a file containing separate |
| debugging information. The function scans various locations in |
| the filesystem, including the file tree rooted at |
| <var>debug_file_directory</var>, and returns the first matching |
| filename that it finds. If <var>check_crc</var> is TRUE then the |
| contents of the file must also match the CRC value contained in |
| <var>section_name</var>. Returns NULL if no valid file could be found. |
| </p> |
| <a name="index-bfd_005ffollow_005fgnu_005fdebuglink"></a> |
| <a name="bfd_005ffollow_005fgnu_005fdebuglink"></a> |
| <h4 class="subsubsection">2.14.1.22 <code>bfd_follow_gnu_debuglink</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Takes a BFD and searches it for a .gnu_debuglink section. If this |
| section is found, it examines the section for the name and checksum |
| of a ’.debug’ file containing auxiliary debugging information. It |
| then searches the filesystem for this .debug file in some standard |
| locations, including the directory tree rooted at <var>dir</var>, and if |
| found returns the full filename. |
| </p> |
| <p>If <var>dir</var> is NULL, it will search a default path configured into |
| libbfd at build time. [XXX this feature is not currently |
| implemented]. |
| </p> |
| <p><strong>Returns</strong><br> |
| <code>NULL</code> on any errors or failure to locate the .debug file, |
| otherwise a pointer to a heap-allocated string containing the |
| filename. The caller is responsible for freeing this string. |
| </p> |
| <a name="index-bfd_005ffollow_005fgnu_005fdebugaltlink"></a> |
| <a name="bfd_005ffollow_005fgnu_005fdebugaltlink"></a> |
| <h4 class="subsubsection">2.14.1.23 <code>bfd_follow_gnu_debugaltlink</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">char *bfd_follow_gnu_debugaltlink (bfd *abfd, const char *dir); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Takes a BFD and searches it for a .gnu_debugaltlink section. If this |
| section is found, it examines the section for the name of a file |
| containing auxiliary debugging information. It then searches the |
| filesystem for this file in a set of standard locations, including |
| the directory tree rooted at <var>dir</var>, and if found returns the |
| full filename. |
| </p> |
| <p>If <var>dir</var> is NULL, it will search a default path configured into |
| libbfd at build time. [FIXME: This feature is not currently |
| implemented]. |
| </p> |
| <p><strong>Returns</strong><br> |
| <code>NULL</code> on any errors or failure to locate the debug file, |
| otherwise a pointer to a heap-allocated string containing the |
| filename. The caller is responsible for freeing this string. |
| </p> |
| <a name="index-bfd_005fcreate_005fgnu_005fdebuglink_005fsection"></a> |
| <a name="bfd_005fcreate_005fgnu_005fdebuglink_005fsection"></a> |
| <h4 class="subsubsection">2.14.1.24 <code>bfd_create_gnu_debuglink_section</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">struct bfd_section *bfd_create_gnu_debuglink_section |
| (bfd *abfd, const char *filename); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Takes a <var>BFD</var> and adds a .gnu_debuglink section to it. The section is sized |
| to be big enough to contain a link to the specified <var>filename</var>. |
| </p> |
| <p><strong>Returns</strong><br> |
| A pointer to the new section is returned if all is ok. Otherwise <code>NULL</code> is |
| returned and bfd_error is set. |
| </p> |
| <a name="index-bfd_005ffill_005fin_005fgnu_005fdebuglink_005fsection"></a> |
| <a name="bfd_005ffill_005fin_005fgnu_005fdebuglink_005fsection"></a> |
| <h4 class="subsubsection">2.14.1.25 <code>bfd_fill_in_gnu_debuglink_section</code></h4> |
| <p><strong>Synopsis</strong> |
| </p><div class="example"> |
| <pre class="example">bfd_boolean bfd_fill_in_gnu_debuglink_section |
| (bfd *abfd, struct bfd_section *sect, const char *filename); |
| </pre></div> |
| <p><strong>Description</strong><br> |
| Takes a <var>BFD</var> and containing a .gnu_debuglink section <var>SECT</var> |
| and fills in the contents of the section to contain a link to the |
| specified <var>filename</var>. The filename should be relative to the |
| current directory. |
| </p> |
| <p><strong>Returns</strong><br> |
| <code>TRUE</code> is returned if all is ok. Otherwise <code>FALSE</code> is returned |
| and bfd_error is set. |
| </p> |
| |
| <hr> |
| <div class="header"> |
| <p> |
| Next: <a href="Internal.html#Internal" accesskey="n" rel="next">Internal</a>, Previous: <a href="Architectures.html#Architectures" accesskey="p" rel="prev">Architectures</a>, Up: <a href="BFD-front-end.html#BFD-front-end" accesskey="u" rel="up">BFD front end</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p> |
| </div> |
| |
| |
| |
| </body> |
| </html> |