Aarch64 linux gnu gdb

Aarch64 linux gnu gdb

When GDB is debugging the AArch64 architecture, it provides the following special commands:

This command determines whether AArch64 architecture-specific debugging messages are to be displayed.

Show whether AArch64 debugging messages are displayed.

21.4.1.1 AArch64 SVE.

When GDB is debugging the AArch64 architecture, if the Scalable Vector Extension (SVE) is present, then GDB will provide the vector registers $z0 through $z31 , vector predicate registers $p0 through $p15 , and the $ffr register. In addition, the pseudo register $vg will be provided. This is the vector granule for the current thread and represents the number of 64-bit chunks in an SVE z register.

If the vector length changes, then the $vg register will be updated, but the lengths of the z and p registers will not change. This is a known limitation of GDB and does not affect the execution of the target process.

21.4.1.2 AArch64 Pointer Authentication.

When GDB is debugging the AArch64 architecture, and the program is using the v8.3-A feature Pointer Authentication (PAC), then whenever the link register $lr is pointing to an PAC function its value will be masked. When GDB prints a backtrace, any addresses that required unmasking will be postfixed with the marker [PAC]. When using the MI, this is printed as part of the addr_flags field.

21.4.1.3 AArch64 Memory Tagging Extension.

When GDB is debugging the AArch64 architecture, the program is using the v8.5-A feature Memory Tagging Extension (MTE) and there is support in the kernel for MTE, GDB will make memory tagging functionality available for inspection and editing of logical and allocation tags. See Memory Tagging.

To aid debugging, GDB will output additional information when SIGSEGV signals are generated as a result of memory tag failures.

If the tag violation is synchronous, the following will be shown:

Program received signal SIGSEGV, Segmentation fault Memory tag violation while accessing address 0x0500fffff7ff8000 Allocation tag 0x1 Logical tag 0x5.

If the tag violation is asynchronous, the fault address is not available. In this case GDB will show the following:

Program received signal SIGSEGV, Segmentation fault Memory tag violation Fault address unavailable.

A special register, tag_ctl , is made available through the org.gnu.gdb.aarch64.mte feature. This register exposes some options that can be controlled at runtime and emulates the prctl option PR_SET_TAGGED_ADDR_CTRL . For further information, see the documentation in the Linux kernel.

GDB supports dumping memory tag data to core files through the gcore command and reading memory tag data from core files generated by the gcore command or the Linux kernel.

When a process uses memory-mapped pages protected by memory tags (for example, AArch64 MTE), this additional information will be recorded in the core file in the event of a crash or if GDB generates a core file from the current process state.

Читайте также:  Ssl сертификат на линукс

The memory tag data will be used so developers can display the memory tags from a particular memory region (using the ‘ m ’ modifier to the x command, using the print command or using the various memory-tag subcommands.

In the case of a crash, GDB will attempt to retrieve the memory tag information automatically from the core file, and will show one of the above messages depending on whether the synchronous or asynchronous mode is selected. See Memory Tagging. See Memory.

Источник

DESCRIPTION

The purpose of a debugger such as GDB is to allow you to see what is going on «inside» another program while it executes — or what another program was doing at the moment it crashed.

GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:

  • Start your program, specifying anything that might affect its behavior.
  • Make your program stop on specified conditions.
  • Examine what has happened, when your program has stopped.
  • Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another.

You can use GDB to debug programs written in C, C++, Fortran and Modula-2.

GDB is invoked with the shell command «gdb» . Once started, it reads commands from the terminal until you tell it to exit with the GDB command «quit» or «exit» . You can get online help from GDB itself by using the command «help» .

You can run «gdb» with no arguments or options; but the most usual way to start GDB is with one argument or two, specifying an executable program as the argument:

You can also start with both an executable program and a core file specified:

You can, instead, specify a process ID as a second argument or use option «-p» , if you want to debug a running process:

gdb program 1234 gdb -p 1234

would attach GDB to process 1234 . With option -p you can omit the program filename.

Here are some of the most frequently needed GDB commands:

break [file:][function|line] Set a breakpoint at function or line (in file). run [arglist] Start your program (with arglist, if specified). bt Backtrace: display the program stack. print expr Display the value of an expression. c Continue running your program (after stopping, e.g. at a breakpoint). next Execute next program line (after stopping); step over any function calls in the line. edit [file:]function look at the program line where it is presently stopped. list [file:]function type the text of the program in the vicinity of where it is presently stopped. step Execute next program line (after stopping); step into any function calls in the line. help [name] Show information about GDB command name, or general information about using GDB. quit exit Exit from GDB.

Читайте также:  Команда узнать пользователя linux

For full details on GDB, see Using GDB: A Guide to the GNU Source-Level Debugger, by Richard M. Stallman and Roland H. Pesch. The same text is available online as the «gdb» entry in the «info» program.

OPTIONS

Any arguments other than options specify an executable file and core file (or process ID); that is, the first argument encountered with no associated option flag is equivalent to a —se option, and the second, if any, is equivalent to a -c option if it’s the name of a file. Many options have both long and abbreviated forms; both are shown here. The long forms are also recognized if you truncate them, so long as enough of the option is present to be unambiguous.

The abbreviated forms are shown here with and long forms are shown with to reflect how they are shown in —help. However, GDB recognizes all of the following conventions for most options:

«—option=value» «—option value» «-option=value» «-option value» «—o=value» «—o value» «-o=value» «-o value«

All the options and command line arguments you give are processed in sequential order. The order makes a difference when the -x option is used.

—help -h List all options, with brief explanations. -s file Read symbol table from file. —write Enable writing into executable and core files. -e file Use file as the executable file to execute when appropriate, and for examining pure data in conjunction with a core dump. -c file Use file as a core dump to examine. -x file Execute GDB commands from file. —eval-command=command -ex command Execute given GDB command. —init-eval-command=command -iex Execute GDB command before loading the inferior. -d directory Add directory to the path to search for source files. —nh Do not execute commands from ~/.config/gdb/gdbinit, ~/.gdbinit, ~/.config/gdb/gdbearlyinit, or ~/.gdbearlyinit —nx -n Do not execute commands from any .gdbinit or .gdbearlyinit initialization files. —quiet —silent -q «Quiet». Do not print the introductory and copyright messages. These messages are also suppressed in batch mode. —batch Run in batch mode. Exit with status 0 after processing all the command files specified with -x (and .gdbinit, if not inhibited). Exit with nonzero status if an error occurs in executing the GDB commands in the command files.

Batch mode may be useful for running GDB as a filter, for example to download and run a program on another computer; in order to make this more useful, the message

(which is ordinarily issued whenever a program running under GDB control terminates) is not issued when running in batch mode.

—batch-silent Run in batch mode, just like —batch, but totally silent. All GDB output is supressed (stderr is unaffected). This is much quieter than —silent and would be useless for an interactive session.

This is particularly useful when using targets that give Loading section messages, for example.

Читайте также:  Где находятся репозитории linux

Note that targets that give their output via GDB, as opposed to writing directly to «stdout» , will also be made silent.

—args prog [arglist] Change interpretation of command line so that arguments following this option are passed as arguments to the inferior. As an example, take the following command:

It would start GDB with -q, not printing the introductory message. On the other hand, using:

starts GDB with the introductory message, and passes the option to the inferior.

—tui Open the terminal user interface. —readnow Read all symbols from the given symfile on the first access. —readnever Do not read symbol files. —return-child-result GDB’s exit code will be the same as the child’s exit code. —configuration Print details about GDB configuration and then exit. —version Print version information and then exit. —data-directory=directory -D Run GDB using directory as its data directory. The data directory is where GDB searches for its auxiliary files. —fullname -f Emacs sets this option when it runs GDB as a subprocess. It tells GDB to output the full file name and line number in a standard, recognizable fashion each time a stack frame is displayed (which includes each time the program stops). This recognizable format looks like two \032 characters, followed by the file name, line number and character position separated by colons, and a newline. The Emacs-to-GDB interface program uses the two \032 characters as a signal to display the source code for the frame. -b baudrate Set the line speed (baud rate or bits per second) of any serial interface used by GDB for remote debugging. -l timeout Set timeout, in seconds, for remote debugging.

SEE ALSO

The full documentation for GDB is maintained as a Texinfo manual. If the «info» and «gdb» programs and GDB’s Texinfo documentation are properly installed at your site, the command

should give you access to the complete manual.

Using GDB: A Guide to the GNU Source-Level Debugger, Richard M. Stallman and Roland H. Pesch, July 1991.

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.»

Powered by archmanweb, using mandoc for the conversion of manual pages.

The website is available under the terms of the GPL-3.0 license, except for the contents of the manual pages, which have their own license specified in the corresponding Arch Linux package.

Источник

Оцените статью
Adblock
detector