How to Enable USB Debugging Mode on Android

Android 2.0-2.3.x

Settings > Applications > Development > USB Debugging
这里写图片描述


Android 3.0- 4.1.x

Settings > Developer Options > USB Debugging

这里写图片描述


Android 4.2.x and higher.

In Android 4.2 and higher versions, the Developer Options menu and USB Debugging option have been hidden. In former 4.X versions of Android, USB Debugging option is under Developer Options menu.

First, you need to enable “Developer Options Menu”.

  1. Click Menu button to enter into App drawer.
  2. Go to “Settings”.
  3. Scroll down to the bottom and tap “About phone” or “About tablet”
  4. Scroll down to the bottom of the “About phone” and locate the “Build Number” field.
    这里写图片描述

  5. Tap the Build number field seven times to enable Developer Options.

  6. When you are done, you’ll see the message “You are now a developer!”.
  7. Tap the Back button and you’ll see the Developer options menu under System on your Settings screen.
  8. Go to Settings>Developer Options>USB Debugging. Tap the USB Debugging checkbox.

Android 5.0 Lollipop

To enable USB Debugging on Android 5.0 Lollipop is the same as Android 4.2.x.

  1. Settings > About Phone > Build number > Tap it 7 times to become developer
    这里写图片描述
  2. Settings > Developer Options > USB Debugging.
    这里写图片描述

Warning

USB Debugging should only be enabled when you need it. Leaving it enabled all the time is kind of a security risk for that this mode grants you high-level access to your device. Say if you connect your Android phone to a USB charging port in a public location, the port could use the USB access to your phone to access data on your phone or install malware. This could happen when and only when USB debugging mode is enabled.

To disable USB Debugging and other developer options when you don’t need them, slide the switch at the top of the screen to OFF.


https://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android.htm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Table of Contents Summary of GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Free software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Free Software Needs Free Documentation . . . . . . . . . . . . . . . . . . . . . . 1 Contributors to GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 A Sample GDB Session . . . . . . . . . . . . . . . . . . . . 7 2 Getting In and Out of GDB . . . . . . . . . . . . . . . 11 2.1 Invoking GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Choosing files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Choosing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Quitting GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Shell commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 GDB Commands . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.1 3.2 3.3 4 Command syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Command completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Getting help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Running Programs Under GDB . . . . . . . . . . . 23 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 5 11 12 13 15 15 Compiling for debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting your program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Your program’s arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Your program’s environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . Your program’s working directory . . . . . . . . . . . . . . . . . . . . . . . Your program’s input and output . . . . . . . . . . . . . . . . . . . . . . . . Debugging an already-running process . . . . . . . . . . . . . . . . . . . Killing the child process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Debugging programs with multiple threads . . . . . . . . . . . . . . . Debugging programs with multiple processes . . . . . . . . . . . . 23 24 25 25 26 26 27 28 28 30 Stopping and Continuing . . . . . . . . . . . . . . . . . . 33 5.1 Breakpoints, watchpoints, and catchpoints . . . . . . . . . . . . . . . 5.1.1 Setting breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.2 Setting watchpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.3 Setting catchpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.4 Deleting breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.5 Disabling breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.6 Break conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.7 Breakpoint command lists . . . . . . . . . . . . . . . . . . . . . . 5.1.8 Breakpoint menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 34 37 39 40 41 42 43 44 ii Debugging with GDB 5.2 5.3 5.4 6 Stack frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Backtraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting a frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Information about a frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Printing source lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Searching source files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specifying source directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . Source and machine code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 58 59 59 Examining Data . . . . . . . . . . . . . . . . . . . . . . . . . . 63 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 8.10 8.11 8.12 8.13 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Artificial arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Output formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Examining memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Automatic display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Value history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Convenience variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Floating point hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Vector Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Memory region attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.13.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.13.1.1 Memory Access Mode . . . . . . . . . . . . . . . . 8.13.1.2 Memory Access Size . . . . . . . . . . . . . . . . . . 8.13.1.3 Data Cache . . . . . . . . . . . . . . . . . . . . . . . . . . 8.14 Copy between memory and a file . . . . . . . . . . . . . . . . . . . . . . . 9 53 54 55 56 Examining Source Files . . . . . . . . . . . . . . . . . . . 57 7.1 7.2 7.3 7.4 8 45 45 48 50 Examining the Stack . . . . . . . . . . . . . . . . . . . . . . 53 6.1 6.2 6.3 6.4 7 5.1.9 “Cannot insert breakpoints” . . . . . . . . . . . . . . . . . . . . Continuing and stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Stopping and starting multi-thread programs . . . . . . . . . . . . . 63 64 65 66 67 68 70 75 76 77 78 78 78 79 79 80 80 80 C Preprocessor Macros . . . . . . . . . . . . . . . . . . . 83 iii 10 Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 10.1 Commands to Set Tracepoints. . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.1 Create and Delete Tracepoints . . . . . . . . . . . . . . . . . 10.1.2 Enable and Disable Tracepoints. . . . . . . . . . . . . . . . 10.1.3 Tracepoint Passcounts . . . . . . . . . . . . . . . . . . . . . . . . 10.1.4 Tracepoint Action Lists . . . . . . . . . . . . . . . . . . . . . . . 10.1.5 Listing Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.6 Starting and Stopping Trace Experiment . . . . . . . 10.2 Using the collected data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2.1 tfind n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2.2 tdump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2.3 save-tracepoints filename . . . . . . . . . . . . . . . . . . . 10.3 Convenience Variables for Tracepoints . . . . . . . . . . . . . . . . . . 11 Debugging Programs That Use Overlays . . 97 11.1 11.2 11.3 11.4 12 87 87 88 88 89 90 91 91 91 93 94 94 How Overlays Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Overlay Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 Automatic Overlay Debugging . . . . . . . . . . . . . . . . . . . . . . . . 100 Overlay Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Using GDB with Different Languages . . . . 103 12.1 12.2 12.3 12.4 Switching between source languages . . . . . . . . . . . . . . . . . . . 12.1.1 List of filename extensions and languages . . . . . . 12.1.2 Setting the working language . . . . . . . . . . . . . . . . . 12.1.3 Having GDB infer the source language . . . . . . . . Displaying the language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Type and range checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3.1 An overview of type checking . . . . . . . . . . . . . . . . . 12.3.2 An overview of range checking . . . . . . . . . . . . . . . . Supported languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.1 C and C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.1.1 C and C++ operators . . . . . . . . . . . . . . . . 12.4.1.2 C and C++ constants . . . . . . . . . . . . . . . . 12.4.1.3 C++ expressions . . . . . . . . . . . . . . . . . . . . . 12.4.1.4 C and C++ defaults . . . . . . . . . . . . . . . . . 12.4.1.5 C and C++ type and range checks . . . . 12.4.1.6 GDB and C . . . . . . . . . . . . . . . . . . . . . . . . 12.4.1.7 GDB features for C++ . . . . . . . . . . . . . . . 12.4.2 Modula-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.2.1 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.2.2 Built-in functions and procedures . . . . 12.4.2.3 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.2.4 Modula-2 defaults . . . . . . . . . . . . . . . . . . . 12.4.2.5 Deviations from standard Modula-2 . . 12.4.2.6 Modula-2 type and range checks . . . . . 12.4.2.7 The scope operators :: and . . . . . . . . . 12.4.2.8 GDB and Modula-2 . . . . . . . . . . . . . . . . . 103 103 104 104 104 105 105 106 107 107 108 109 110 111 111 111 112 113 113 114 115 116 116 116 117 117 iv Debugging with GDB 13 Examining the Symbol Table . . . . . . . . . . . . 119 14 Altering Execution . . . . . . . . . . . . . . . . . . . . . 123 14.1 14.2 14.3 14.4 14.5 14.6 15 Active targets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Commands for managing targets . . . . . . . . . . . . . . . . . . . . . . Choosing target byte order. . . . . . . . . . . . . . . . . . . . . . . . . . . . Remote debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Kernel Object Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 135 137 137 138 Debugging remote programs . . . . . . . . . . . . 139 17.1 17.2 17.3 18 Commands to specify files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Errors reading symbol files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Specifying a Debugging Target . . . . . . . . . . 135 16.1 16.2 16.3 16.4 16.5 17 123 124 125 125 126 126 GDB Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 15.1 15.2 16 Assignment to variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Continuing at a different address . . . . . . . . . . . . . . . . . . . . . . Giving your program a signal . . . . . . . . . . . . . . . . . . . . . . . . . Returning from a function . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calling program functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . Patching programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the gdbserver program. . . . . . . . . . . . . . . . . . . . . . . . . Using the gdbserve.nlm program . . . . . . . . . . . . . . . . . . . . . Implementing a remote stub . . . . . . . . . . . . . . . . . . . . . . . . . . 17.3.1 What the stub can do for you . . . . . . . . . . . . . . . . 17.3.2 What you must do for the stub . . . . . . . . . . . . . . . 17.3.3 Putting it all together . . . . . . . . . . . . . . . . . . . . . . . 139 140 141 142 142 144 Configuration-Specific Information . . . . . . . 147 18.1 Native . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.1.1 HP-UX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.1.2 SVR4 process information . . . . . . . . . . . . . . . . . . . . 18.1.3 Features for Debugging djgpp Programs . . . . . . 18.1.4 Features for Debugging MS Windows PE executables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2 Embedded Operating Systems. . . . . . . . . . . . . . . . . . . . . . . . . 18.2.1 Using GDB with VxWorks . . . . . . . . . . . . . . . . . . . 18.2.1.1 Connecting to VxWorks . . . . . . . . . . . . . 18.2.1.2 VxWorks download . . . . . . . . . . . . . . . . . 18.2.1.3 Running tasks . . . . . . . . . . . . . . . . . . . . . . 18.3 Embedded Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.3.1 ARM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.3.2 Hitachi H8/300 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.3.2.1 Connecting to Hitachi boards . . . . . . . . 18.3.2.2 Using the E7000 in-circuit emulator . . 147 147 147 147 149 150 150 151 151 152 152 152 152 153 154 v 18.4 19 Controlling GDB . . . . . . . . . . . . . . . . . . . . . . . 165 19.1 19.2 19.3 19.4 19.5 19.6 19.7 20 18.3.2.3 Special GDB commands for Hitachi micros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 18.3.3 H8/500 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 18.3.4 Intel i960 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 18.3.4.1 Startup with Nindy . . . . . . . . . . . . . . . . . 156 18.3.4.2 Options for Nindy . . . . . . . . . . . . . . . . . . 156 18.3.4.3 Nindy reset command . . . . . . . . . . . . . . . 156 18.3.5 Mitsubishi M32R/D . . . . . . . . . . . . . . . . . . . . . . . . . 156 18.3.6 M68k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 18.3.7 MIPS Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 18.3.8 PowerPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 18.3.9 HP PA Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 18.3.10 Hitachi SH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 18.3.11 Tsqware Sparclet . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 18.3.11.1 Setting file to debug. . . . . . . . . . . . . . . . 160 18.3.11.2 Connecting to Sparclet . . . . . . . . . . . . . 160 18.3.11.3 Sparclet download . . . . . . . . . . . . . . . . . 161 18.3.11.4 Running and debugging . . . . . . . . . . . . 161 18.3.12 Fujitsu Sparclite . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 18.3.13 Tandem ST2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 18.3.14 Zilog Z8000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 Architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 18.4.1 A29K . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 18.4.2 Alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 18.4.3 MIPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Screen size. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Optional warnings and messages . . . . . . . . . . . . . . . . . . . . . . Optional messages about internal happenings. . . . . . . . . . . Canned Sequences of Commands . . . . . . . . 171 20.1 User-defined commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.2 User-defined command hooks . . . . . . . . . . . . . . . . . . . . . . . . . 20.3 Command files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.4 Commands for controlled output . . . . . . . . . . . . . . . . . . . . . . 21 165 165 165 167 167 168 169 171 172 173 174 GDB Text User Interface . . . . . . . . . . . . . . . 177 21.1 21.2 21.3 21.4 21.5 TUI TUI TUI TUI TUI overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Key Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . specific commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . configuration variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 178 179 179 180 vi Debugging with GDB 22 Using GDB under gnu Emacs . . . . . . . . . . . 183 23 GDB Annotations . . . . . . . . . . . . . . . . . . . . . . 185 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 23.10 23.11 23.12 24 What is an Annotation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Server Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Annotation for GDB Input. . . . . . . . . . . . . . . . . . . . . . . . . . . . Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Information on Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . Invalidation Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Displaying Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Annotations We Might Want in the Future . . . . . . . . . . . . The gdb/mi Interface . . . . . . . . . . . . . . . . . . . 193 Function and Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notation and Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.1 gdb/mi Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.1.1 gdb/mi Input Syntax . . . . . . . . . . . . . . . . . . . . . . . . 24.1.2 gdb/mi Output Syntax . . . . . . . . . . . . . . . . . . . . . . 24.1.3 Simple Examples of gdb/mi Interaction . . . . . . . 24.2 gdb/mi Compatibility with CLI . . . . . . . . . . . . . . . . . . . . . . . 24.3 gdb/mi Output Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.3.1 gdb/mi Result Records . . . . . . . . . . . . . . . . . . . . . . 24.3.2 gdb/mi Stream Records . . . . . . . . . . . . . . . . . . . . . 24.3.3 gdb/mi Out-of-band Records . . . . . . . . . . . . . . . . . 24.4 gdb/mi Command Description Format . . . . . . . . . . . . . . . . 24.5 gdb/mi Breakpoint table commands. . . . . . . . . . . . . . . . . . . 24.6 gdb/mi Data Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.7 gdb/mi Program control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.8 Miscellaneous GDB commands in gdb/mi. . . . . . . . . . . . . . 24.9 gdb/mi Stack Manipulation Commands . . . . . . . . . . . . . . . 24.10 gdb/mi Symbol Query Commands . . . . . . . . . . . . . . . . . . . 24.11 gdb/mi Target Manipulation Commands . . . . . . . . . . . . . 24.12 gdb/mi Thread Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 24.13 gdb/mi Tracepoint Commands. . . . . . . . . . . . . . . . . . . . . . . 24.14 gdb/mi Variable Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 185 185 186 187 189 189 190 190 191 191 192 192 193 193 193 193 194 196 197 197 197 197 198 198 199 207 217 227 229 234 237 242 244 244 Reporting Bugs in GDB . . . . . . . . . . . . . . . . 249 25.1 25.2 Have you found a bug? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 How to report bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 vii 26 Command Line Editing . . . . . . . . . . . . . . . . . 253 26.1 26.2 26.3 26.4 26.5 27 Introduction to Line Editing . . . . . . . . . . . . . . . . . . . . . . . . . . Readline Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.2.1 Readline Bare Essentials . . . . . . . . . . . . . . . . . . . . . 26.2.2 Readline Movement Commands . . . . . . . . . . . . . . . 26.2.3 Readline Killing Commands . . . . . . . . . . . . . . . . . . 26.2.4 Readline Arguments . . . . . . . . . . . . . . . . . . . . . . . . . 26.2.5 Searching for Commands in the History . . . . . . . Readline Init File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.3.1 Readline Init File Syntax . . . . . . . . . . . . . . . . . . . . . 26.3.2 Conditional Init Constructs . . . . . . . . . . . . . . . . . . 26.3.3 Sample Init File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bindable Readline Commands . . . . . . . . . . . . . . . . . . . . . . . . . 26.4.1 Commands For Moving . . . . . . . . . . . . . . . . . . . . . . 26.4.2 Commands For Manipulating The History . . . . . 26.4.3 Commands For Changing Text . . . . . . . . . . . . . . . 26.4.4 Killing And Yanking . . . . . . . . . . . . . . . . . . . . . . . . . 26.4.5 Specifying Numeric Arguments . . . . . . . . . . . . . . . 26.4.6 Letting Readline Type For You . . . . . . . . . . . . . . . 26.4.7 Keyboard Macros. . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.4.8 Some Miscellaneous Commands . . . . . . . . . . . . . . . Readline vi Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 253 253 254 254 255 255 256 256 260 261 264 264 264 265 266 267 268 268 269 270 Using History Interactively. . . . . . . . . . . . . . 271 27.1 History 27.1.1 27.1.2 27.1.3 Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Event Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . Word Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 271 272 272 Appendix A Formatting Documentation . . . . 275 Appendix B Installing GDB . . . . . . . . . . . . . . . . 277 B.1 B.2 B.3 Compiling GDB in another directory . . . . . . . . . . . . . . . . . . . 278 Specifying names for hosts and targets . . . . . . . . . . . . . . . . . 279 configure options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 Appendix C Maintenance Commands . . . . . . . 281 Appendix D GDB Remote Serial Protocol . . 283 D.1 D.2 D.3 D.4 D.5 D.6 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Stop Reply Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . General Query Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Register Packet Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 284 289 290 292 293 viii Debugging with GDB Appendix E GNU GENERAL PUBLIC LICENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION . . . . . . . . . . . . . . . 296 How to Apply These Terms to Your New Programs . . . . . . . . . . . 300 Appendix F GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 ADDENDUM: How to use this License for your documents . . . . 308 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Table of Contents q q q q q Summary of GDB r Free software r Free Software Needs Free Documentation r Contributors to GDB A Sample GDB Session Getting In and Out of GDB r Invoking GDB s Choosing files s Choosing modes r Quitting GDB r Shell commands GDB Commands r Command syntax r Command completion r Getting help Running Programs Under GDB r Compiling for debugging r Starting your program r Your program's arguments r Your program's environment r Your program's working directory r Your program's input and output file:///C|/gdb.html (1 of 352)19. 1. 2004 20:32:03 Debugging with GDB Debugging an already-running process r Killing the child process r Debugging programs with multiple threads r Debugging programs with multiple processes Stopping and Continuing r Breakpoints, watchpoints, and catchpoints s Setting breakpoints s Setting watchpoints s Setting catchpoints s Deleting breakpoints s Disabling breakpoints s Break conditions s Breakpoint command lists s Breakpoint menus s "Cannot insert breakpoints" r Continuing and stepping r Signals r Stopping and starting multi-thread programs Examining the Stack r Stack frames r Backtraces r Selecting a frame r Information about a frame Examining Source Files r Printing source lines r Searching source files r Specifying source directories r Source and machine code Examining Data r Expressions r Program variables r Artificial arrays r Output formats r Examining memory r Automatic display r Print settings r Value history r Convenience variables r q q q q file:///C|/gdb.html (2 of 352)19. 1. 2004 20:32:03 Debugging with GDB Registers r Floating point hardware r Memory Region Attributes s Attributes s Memory Access Mode s Memory Access Size s Data Cache Tracepoints r Commands to Set Tracepoints s Create and Delete Tracepoints s Enable and Disable Tracepoints s Tracepoint Passcounts s Tracepoint Action Lists s Listing Tracepoints s Starting and Stopping Trace Experiment r Using the collected data s tfind n s tdump s save-tracepoints filename r Convenience Variables for Tracepoints Using GDB with Different Languages r Switching between source languages s List of filename extensions and languages s Setting the working language s Having GDB infer the source language r Displaying the language r Type and range checking s An overview of type checking s An overview of range checking r Supported languages s C and C++ s C and C++ operators s C and C++ constants s C++ expressions s C and C++ defaults s C and C++ type and range checks s GDB and C s GDB features for C++ r q q file:///C|/gdb.html (3 of 352)19. 1. 2004 20:32:03 Debugging with GDB Modula-2 s Operators s Built-in functions and procedures s Constants s Modula-2 defaults s Deviations from standard Modula-2 s Modula-2 type and range checks s The scope operators :: and . s GDB and Modula-2 s Chill s How modes are displayed s Locations and their accesses s Values and their Operations s Chill type and range checks s Chill defaults Examining the Symbol Table Altering Execution r Assignment to variables r Continuing at a different address r Giving your program a signal r Returning from a function r Calling program functions r Patching programs GDB Files r Commands to specify files r Errors reading symbol files Specifying a Debugging Target r Active targets r Commands for managing targets r Choosing target byte order r Remote debugging s The GDB remote serial protocol s What the stub can do for you s What you must do for the stub s Putting it all together s Communication protocol s Using the gdbserver program s Using the gdbserve.nlm program s q q q q file:///C|/gdb.html (4 of 352)19. 1. 2004 20:32:03 Debugging with GDB Kernel Object Display Configuration-Specific Information r Native s HP-UX s SVR4 process information s Features for Debugging DJGPP Programs r Embedded Operating Systems s Using GDB with VxWorks s Connecting to VxWorks s VxWorks download s Running tasks r Embedded Processors s AMD A29K Embedded s A29K UDI s EBMON protocol for AMD29K s Communications setup s EB29K cross-debugging s Remote log s ARM s Hitachi H8/300 s Connecting to Hitachi boards s Using the E7000 in-circuit emulator s Special GDB commands for Hitachi micros s H8/500 s Intel i960 s Startup with Nindy s Options for Nindy s Nindy reset command s Mitsubishi M32R/D s M68k s M88K s MIPS Embedded s PowerPC s HP PA Embedded s Hitachi SH s Tsqware Sparclet s Setting file to debug s Connecting to Sparclet r q file:///C|/gdb.html (5 of 352)19. 1. 2004 20:32:03 Debugging with GDB Sparclet download s Running and debugging s Fujitsu Sparclite s Tandem ST2000 s Zilog Z8000 r Architectures s A29K s Alpha s MIPS Controlling GDB r Prompt r Command editing r Command history r Screen size r Numbers r Optional warnings and messages r Optional messages about internal happenings Canned Sequences of Commands r User-defined commands r User-defined command hooks r Command files r Commands for controlled output GDB Text User Interface r TUI overview r TUI Key Bindings r TUI specific commands r TUI configuration variables Using GDB under GNU Emacs GDB Annotations r What is an Annotation? r The Server Prefix r Values r Frames r Displays r Annotation for GDB Input r Errors r Information on Breakpoints r Invalidation Notices s q q q q q file:///C|/gdb.html (6 of 352)19. 1. 2004 20:32:03 Debugging with GDB Running the Program r Displaying Source r Annotations We Might Want in the Future The GDB/MI Interface r Function and Purpose r Notation and Terminology r GDB/MI Command Syntax s GDB/MI Input Syntax s GDB/MI Output Syntax s Simple Examples of GDB/MI Interaction r GDB/MI Compatibility with CLI r GDB/MI Output Records s GDB/MI Result Records s GDB/MI Stream Records s GDB/MI Out-of-band Records r GDB/MI Command Description Format r GDB/MI Breakpoint table commands r GDB/MI Data Manipulation r GDB/MI Program control r Miscellaneous GDB commands in GDB/MI r GDB/MI Stack Manipulation Commands r GDB/MI Symbol Query Commands r GDB/MI Target Manipulation Commands r GDB/MI Thread Commands r GDB/MI Tracepoint Commands r GDB/MI Variable Objects Reporting Bugs in GDB r Have you found a bug? r How to report bugs Command Line Editing r Introduction to Line Editing r Readline Interaction s Readline Bare Essentials s Readline Movement Commands s Readline Killing Commands s Readline Arguments s Searching for Commands in the History r Readline Init File r q q q file:///C|/gdb.html (7 of 352)19. 1. 2004 20:32:03 Debugging with GDB Readline Init File Syntax s Conditional Init Constructs s Sample Init File r Bindable Readline Commands s Commands For Moving s Commands For Manipulating The History s Commands For Changing Text s Killing And Yanking s Specifying Numeric Arguments s Letting Readline Type For You s Keyboard Macros s Some Miscellaneous Commands r Readline vi Mode Using History Interactively r History Expansion s Event Designators s Word Designators s Modifiers Formatting Documentation Installing GDB r Compiling GDB in another directory r Specifying names for hosts and targets r configure options GNU Free Documentation License r ADDENDUM: How to use this License for your documents Index

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值