summaryrefslogtreecommitdiff
path: root/share/doc/gdb/Non_002ddebug-DLL-Symbols.html
diff options
context:
space:
mode:
authoralk3pInjection <webmaster@raspii.tech>2024-02-04 16:16:35 +0800
committeralk3pInjection <webmaster@raspii.tech>2024-02-04 16:16:35 +0800
commitabdaadbcae30fe0c9a66c7516798279fdfd97750 (patch)
tree00a54a6e25601e43876d03c1a4a12a749d4a914c /share/doc/gdb/Non_002ddebug-DLL-Symbols.html
Import stripped Arm GNU Toolchain 13.2.Rel1HEADumineko
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads Change-Id: I7303388733328cd98ab9aa3c30236db67f2e9e9c
Diffstat (limited to 'share/doc/gdb/Non_002ddebug-DLL-Symbols.html')
-rw-r--r--share/doc/gdb/Non_002ddebug-DLL-Symbols.html195
1 files changed, 195 insertions, 0 deletions
diff --git a/share/doc/gdb/Non_002ddebug-DLL-Symbols.html b/share/doc/gdb/Non_002ddebug-DLL-Symbols.html
new file mode 100644
index 0000000..2706d85
--- /dev/null
+++ b/share/doc/gdb/Non_002ddebug-DLL-Symbols.html
@@ -0,0 +1,195 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- Copyright (C) 1988-2023 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." -->
+<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>Debugging with GDB: Non-debug DLL Symbols</title>
+
+<meta name="description" content="Debugging with GDB: Non-debug DLL Symbols">
+<meta name="keywords" content="Debugging with GDB: Non-debug DLL Symbols">
+<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="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
+<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
+<link href="Cygwin-Native.html#Cygwin-Native" rel="up" title="Cygwin Native">
+<link href="Hurd-Native.html#Hurd-Native" rel="next" title="Hurd Native">
+<link href="Cygwin-Native.html#Cygwin-Native" rel="previous" title="Cygwin Native">
+<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="Non_002ddebug-DLL-Symbols"></a>
+<div class="header">
+<p>
+Up: <a href="Cygwin-Native.html#Cygwin-Native" accesskey="u" rel="up">Cygwin Native</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
+</div>
+<hr>
+<a name="Support-for-DLLs-without-Debugging-Symbols"></a>
+<h4 class="subsubsection">21.1.4.1 Support for DLLs without Debugging Symbols</h4>
+<a name="index-DLLs-with-no-debugging-symbols"></a>
+<a name="index-Minimal-symbols-and-DLLs"></a>
+
+<p>Very often on windows, some of the DLLs that your program relies on do
+not include symbolic debugging information (for example,
+<samp>kernel32.dll</samp>). When <small>GDB</small> doesn&rsquo;t recognize any debugging
+symbols in a DLL, it relies on the minimal amount of symbolic
+information contained in the DLL&rsquo;s export table. This section
+describes working with such symbols, known internally to <small>GDB</small> as
+&ldquo;minimal symbols&rdquo;.
+</p>
+<p>Note that before the debugged program has started execution, no DLLs
+will have been loaded. The easiest way around this problem is simply to
+start the program &mdash; either by setting a breakpoint or letting the
+program run once to completion.
+</p>
+<a name="DLL-Name-Prefixes"></a>
+<h4 class="subsubsection">21.1.4.2 DLL Name Prefixes</h4>
+
+<p>In keeping with the naming conventions used by the Microsoft debugging
+tools, DLL export symbols are made available with a prefix based on the
+DLL name, for instance <code>KERNEL32!CreateFileA</code>. The plain name is
+also entered into the symbol table, so <code>CreateFileA</code> is often
+sufficient. In some cases there will be name clashes within a program
+(particularly if the executable itself includes full debugging symbols)
+necessitating the use of the fully qualified name when referring to the
+contents of the DLL. Use single-quotes around the name to avoid the
+exclamation mark (&ldquo;!&rdquo;) being interpreted as a language operator.
+</p>
+<p>Note that the internal name of the DLL may be all upper-case, even
+though the file name of the DLL is lower-case, or vice-versa. Since
+symbols within <small>GDB</small> are <em>case-sensitive</em> this may cause
+some confusion. If in doubt, try the <code>info functions</code> and
+<code>info variables</code> commands or even <code>maint print msymbols</code>
+(see <a href="Symbols.html#Symbols">Symbols</a>). Here&rsquo;s an example:
+</p>
+<div class="smallexample">
+<pre class="smallexample">(gdb) info function CreateFileA
+All functions matching regular expression &quot;CreateFileA&quot;:
+
+Non-debugging symbols:
+0x77e885f4 CreateFileA
+0x77e885f4 KERNEL32!CreateFileA
+</pre></div>
+
+<div class="smallexample">
+<pre class="smallexample">(gdb) info function !
+All functions matching regular expression &quot;!&quot;:
+
+Non-debugging symbols:
+0x6100114c cygwin1!__assert
+0x61004034 cygwin1!_dll_crt0@0
+0x61004240 cygwin1!dll_crt0(per_process *)
+[etc...]
+</pre></div>
+
+<a name="Working-with-Minimal-Symbols"></a>
+<h4 class="subsubsection">21.1.4.3 Working with Minimal Symbols</h4>
+
+<p>Symbols extracted from a DLL&rsquo;s export table do not contain very much
+type information. All that <small>GDB</small> can do is guess whether a symbol
+refers to a function or variable depending on the linker section that
+contains the symbol. Also note that the actual contents of the memory
+contained in a DLL are not available unless the program is running. This
+means that you cannot examine the contents of a variable or disassemble
+a function within a DLL without a running program.
+</p>
+<p>Variables are generally treated as pointers and dereferenced
+automatically. For this reason, it is often necessary to prefix a
+variable name with the address-of operator (&ldquo;&amp;&rdquo;) and provide explicit
+type information in the command. Here&rsquo;s an example of the type of
+problem:
+</p>
+<div class="smallexample">
+<pre class="smallexample">(gdb) print 'cygwin1!__argv'
+'cygwin1!__argv' has unknown type; cast it to its declared type
+</pre></div>
+
+<div class="smallexample">
+<pre class="smallexample">(gdb) x 'cygwin1!__argv'
+'cygwin1!__argv' has unknown type; cast it to its declared type
+</pre></div>
+
+<p>And two possible solutions:
+</p>
+<div class="smallexample">
+<pre class="smallexample">(gdb) print ((char **)'cygwin1!__argv')[0]
+$2 = 0x22fd98 &quot;/cygdrive/c/mydirectory/myprogram&quot;
+</pre></div>
+
+<div class="smallexample">
+<pre class="smallexample">(gdb) x/2x &amp;'cygwin1!__argv'
+0x610c0aa8 &lt;cygwin1!__argv&gt;: 0x10021608 0x00000000
+(gdb) x/x 0x10021608
+0x10021608: 0x0022fd98
+(gdb) x/s 0x0022fd98
+0x22fd98: &quot;/cygdrive/c/mydirectory/myprogram&quot;
+</pre></div>
+
+<p>Setting a break point within a DLL is possible even before the program
+starts execution. However, under these circumstances, <small>GDB</small> can&rsquo;t
+examine the initial instructions of the function in order to skip the
+function&rsquo;s frame set-up code. You can work around this by using &ldquo;*&amp;&rdquo;
+to set the breakpoint at a raw memory address:
+</p>
+<div class="smallexample">
+<pre class="smallexample">(gdb) break *&amp;'python22!PyOS_Readline'
+Breakpoint 1 at 0x1e04eff0
+</pre></div>
+
+<p>The author of these extensions is not entirely convinced that setting a
+break point within a shared DLL like <samp>kernel32.dll</samp> is completely
+safe.
+</p>
+<hr>
+<div class="header">
+<p>
+Up: <a href="Cygwin-Native.html#Cygwin-Native" accesskey="u" rel="up">Cygwin Native</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
+</div>
+
+
+
+</body>
+</html>