You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Stub-Contents.html 6.0KB

4 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Stub Contents (Debugging with GDB)</title>
  17. <meta name="description" content="Stub Contents (Debugging with GDB)">
  18. <meta name="keywords" content="Stub Contents (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Remote-Stub.html#Remote-Stub" rel="up" title="Remote Stub">
  26. <link href="Bootstrapping.html#Bootstrapping" rel="next" title="Bootstrapping">
  27. <link href="Remote-Stub.html#Remote-Stub" rel="prev" title="Remote Stub">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Stub-Contents"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Bootstrapping.html#Bootstrapping" accesskey="n" rel="next">Bootstrapping</a>, Up: <a href="Remote-Stub.html#Remote-Stub" accesskey="u" rel="up">Remote Stub</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>
  61. </div>
  62. <hr>
  63. <a name="What-the-Stub-Can-Do-for-You"></a>
  64. <h4 class="subsection">20.5.1 What the Stub Can Do for You</h4>
  65. <a name="index-remote-serial-stub"></a>
  66. <p>The debugging stub for your architecture supplies these three
  67. subroutines:
  68. </p>
  69. <dl compact="compact">
  70. <dt><code>set_debug_traps</code></dt>
  71. <dd><a name="index-set_005fdebug_005ftraps"></a>
  72. <a name="index-remote-serial-stub_002c-initialization"></a>
  73. <p>This routine arranges for <code>handle_exception</code> to run when your
  74. program stops. You must call this subroutine explicitly in your
  75. program&rsquo;s startup code.
  76. </p>
  77. </dd>
  78. <dt><code>handle_exception</code></dt>
  79. <dd><a name="index-handle_005fexception"></a>
  80. <a name="index-remote-serial-stub_002c-main-routine"></a>
  81. <p>This is the central workhorse, but your program never calls it
  82. explicitly&mdash;the setup code arranges for <code>handle_exception</code> to
  83. run when a trap is triggered.
  84. </p>
  85. <p><code>handle_exception</code> takes control when your program stops during
  86. execution (for example, on a breakpoint), and mediates communications
  87. with <small>GDB</small> on the host machine. This is where the communications
  88. protocol is implemented; <code>handle_exception</code> acts as the <small>GDB</small>
  89. representative on the target machine. It begins by sending summary
  90. information on the state of your program, then continues to execute,
  91. retrieving and transmitting any information <small>GDB</small> needs, until you
  92. execute a <small>GDB</small> command that makes your program resume; at that point,
  93. <code>handle_exception</code> returns control to your own code on the target
  94. machine.
  95. </p>
  96. </dd>
  97. <dt><code>breakpoint</code></dt>
  98. <dd><a name="index-breakpoint-subroutine_002c-remote"></a>
  99. <p>Use this auxiliary subroutine to make your program contain a
  100. breakpoint. Depending on the particular situation, this may be the only
  101. way for <small>GDB</small> to get control. For instance, if your target
  102. machine has some sort of interrupt button, you won&rsquo;t need to call this;
  103. pressing the interrupt button transfers control to
  104. <code>handle_exception</code>&mdash;in effect, to <small>GDB</small>. On some machines,
  105. simply receiving characters on the serial port may also trigger a trap;
  106. again, in that situation, you don&rsquo;t need to call <code>breakpoint</code> from
  107. your own program&mdash;simply running &lsquo;<samp>target remote</samp>&rsquo; from the host
  108. <small>GDB</small> session gets control.
  109. </p>
  110. <p>Call <code>breakpoint</code> if none of these is true, or if you simply want
  111. to make certain your program stops at a predetermined point for the
  112. start of your debugging session.
  113. </p></dd>
  114. </dl>
  115. <hr>
  116. <div class="header">
  117. <p>
  118. Next: <a href="Bootstrapping.html#Bootstrapping" accesskey="n" rel="next">Bootstrapping</a>, Up: <a href="Remote-Stub.html#Remote-Stub" accesskey="u" rel="up">Remote Stub</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>
  119. </div>
  120. </body>
  121. </html>