| <html lang="en"> |
| <head> |
| <title>Which flavor to choose? - 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-extensions.html#Auto_002dloading-extensions" title="Auto-loading extensions"> |
| <link rel="prev" href="dotdebug_005fgdb_005fscripts-section.html#dotdebug_005fgdb_005fscripts-section" title="dotdebug_gdb_scripts section"> |
| <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="Which-flavor-to-choose%3f"></a> |
| <a name="Which-flavor-to-choose_003f"></a> |
| <p> |
| Previous: <a rel="previous" accesskey="p" href="dotdebug_005fgdb_005fscripts-section.html#dotdebug_005fgdb_005fscripts-section">dotdebug_gdb_scripts section</a>, |
| Up: <a rel="up" accesskey="u" href="Auto_002dloading-extensions.html#Auto_002dloading-extensions">Auto-loading extensions</a> |
| <hr> |
| </div> |
| |
| <h4 class="subsection">23.4.3 Which flavor to choose?</h4> |
| |
| <p>Given the multiple ways of auto-loading extensions, it might not always |
| be clear which one to choose. This section provides some guidance. |
| |
| <p class="noindent">Benefits of the <samp><span class="file">-gdb.</span><var>ext</var></samp> way: |
| |
| <ul> |
| <li>Can be used with file formats that don't support multiple sections. |
| |
| <li>Ease of finding scripts for public libraries. |
| |
| <p>Scripts specified in the <code>.debug_gdb_scripts</code> section are searched for |
| in the source search path. |
| For publicly installed libraries, e.g., <samp><span class="file">libstdc++</span></samp>, there typically |
| isn't a source directory in which to find the script. |
| |
| <li>Doesn't require source code additions. |
| </ul> |
| |
| <p class="noindent">Benefits of the <code>.debug_gdb_scripts</code> way: |
| |
| <ul> |
| <li>Works with static linking. |
| |
| <p>Scripts for libraries done the <samp><span class="file">-gdb.</span><var>ext</var></samp> way require an objfile to |
| trigger their loading. When an application is statically linked the only |
| objfile available is the executable, and it is cumbersome to attach all the |
| scripts from all the input libraries to the executable's |
| <samp><span class="file">-gdb.</span><var>ext</var></samp> script. |
| |
| <li>Works with classes that are entirely inlined. |
| |
| <p>Some classes can be entirely inlined, and thus there may not be an associated |
| shared library to attach a <samp><span class="file">-gdb.</span><var>ext</var></samp> script to. |
| |
| <li>Scripts needn't be copied out of the source tree. |
| |
| <p>In some circumstances, apps can be built out of large collections of internal |
| libraries, and the build infrastructure necessary to install the |
| <samp><span class="file">-gdb.</span><var>ext</var></samp> scripts in a place where <span class="sc">gdb</span> can find them is |
| cumbersome. It may be easier to specify the scripts in the |
| <code>.debug_gdb_scripts</code> section as relative paths, and add a path to the |
| top of the source tree to the source search path. |
| </ul> |
| |
| </body></html> |
| |