GDB (xrefs)

Classes | Functions | Variables
cli-dump.c File Reference
`#include "defs.h"`
`#include "cli/cli-decode.h"`
`#include "cli/cli-cmds.h"`
`#include "value.h"`
`#include "completer.h"`
`#include <ctype.h>`
`#include "target.h"`
`#include "readline/readline.h"`
`#include "gdbcore.h"`
`#include "cli/cli-utils.h"`
`#include "gdb_bfd.h"`
`#include "filestuff.h"`
`#include "common/byte-vector.h"`

Go to the source code of this file.

## Classes
struct | dump_context
struct | callback_data

## Functions
static gdb::unique_xmalloc_ptr< char > | scan_expression (const char **cmd, const char *def)
static gdb::unique_xmalloc_ptr< char > | scan_filename (const char **cmd, const char *defname)
static gdb_bfd_ref_ptr | bfd_openr_or_error (const char *filename, const char *target)
static gdb_bfd_ref_ptr | bfd_openw_or_error (const char *filename, const char *target, const char *mode)
static void | dump_command (const char *cmd, int from_tty)
static void | append_command (const char *cmd, int from_tty)
static void | dump_binary_file (const char *filename, const char *mode, const bfd_byte *buf, ULONGEST len)
static void | dump_bfd_file (const char *filename, const char *mode, const char *target, CORE_ADDR vaddr, const bfd_byte *buf, ULONGEST len)
static void | dump_memory_to_file (const char *cmd, const char *mode, const char *file_format)
static void | dump_memory_command (const char *cmd, const char *mode)
static void | dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
static void | dump_value_command (const char *cmd, const char *mode)
static void | dump_srec_memory (const char *args, int from_tty)
static void | dump_srec_value (const char *args, int from_tty)
static void | dump_ihex_memory (const char *args, int from_tty)
static void | dump_ihex_value (const char *args, int from_tty)
static void | dump_verilog_memory (const char *args, int from_tty)
static void | dump_verilog_value (const char *args, int from_tty)
static void | dump_tekhex_memory (const char *args, int from_tty)
static void | dump_tekhex_value (const char *args, int from_tty)
static void | dump_binary_memory (const char *args, int from_tty)
static void | dump_binary_value (const char *args, int from_tty)
static void | append_binary_memory (const char *args, int from_tty)
static void | append_binary_value (const char *args, int from_tty)
static void | call_dump_func (struct cmd_list_element *c, const char *args, int from_tty)
static void | add_dump_command (const char *name, void(*func)(const char *args, const char *mode), const char *descr)
static void | restore_section_callback (bfd *ibfd, asection *isec, void *args)
static void | restore_binary_file (const char *filename, struct callback_data *data)
static void | restore_command (const char *args, int from_tty)
static void | srec_dump_command (const char *cmd, int from_tty)
static void | ihex_dump_command (const char *cmd, int from_tty)
static void | verilog_dump_command (const char *cmd, int from_tty)
static void | tekhex_dump_command (const char *cmd, int from_tty)
static void | binary_dump_command (const char *cmd, int from_tty)
static void | binary_append_command (const char *cmd, int from_tty)
void | _initialize_cli_dump (void)

## Variables
static struct cmd_list_element * | dump_cmdlist
static struct cmd_list_element * | append_cmdlist
static struct cmd_list_element * | srec_cmdlist
static struct cmd_list_element * | ihex_cmdlist
static struct cmd_list_element * | verilog_cmdlist
static struct cmd_list_element * | tekhex_cmdlist
static struct cmd_list_element * | binary_dump_cmdlist
static struct cmd_list_element * | binary_append_cmdlist

## Function Documentation

## ◆ _initialize_cli_dump()

void _initialize_cli_dump | ( | void |  | ) |

Definition at line 624 of file cli-dump.c.

References _, add_cmd(), add_com(), add_dump_command(), add_prefix_cmd(), all_commands, append_binary_memory(), append_binary_value(), append_cmdlist, append_command(), binary_append_cmdlist, binary_append_command(), binary_dump_cmdlist, binary_dump_command(), class_vars, cmdlist, cmd_list_element::completer, dump_binary_memory(), dump_binary_value(), dump_cmdlist, dump_command(), dump_ihex_memory(), dump_ihex_value(), dump_memory_command(), dump_srec_memory(), dump_srec_value(), dump_tekhex_memory(), dump_tekhex_value(), dump_value_command(), dump_verilog_memory(), dump_verilog_value(), filename_completer(), ihex_cmdlist, ihex_dump_command(), restore_command(), srec_cmdlist, srec_dump_command(), tekhex_cmdlist, tekhex_dump_command(), verilog_cmdlist, and verilog_dump_command().

## ◆ add_dump_command()

static void add_dump_command | ( | const char * | name,
|  | void(*)(const char *args, const char *mode) | func,
|  | const char * | descr
| ) |  |
| static

Definition at line 354 of file cli-dump.c.

References add_cmd(), all_commands, append_cmdlist, call_dump_func(), cmd_list_element::completer, cmd_list_element::doc, dump_cmdlist, filename_completer(), cmd_list_element::func, dump_context::func, func, dump_context::mode, name, set_cmd_context(), and XNEW.

Referenced by _initialize_cli_dump().

## ◆ append_binary_memory()

static void append_binary_memory | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 328 of file cli-dump.c.

References dump_memory_to_file().

Referenced by _initialize_cli_dump().

## ◆ append_binary_value()

static void append_binary_value | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 334 of file cli-dump.c.

References dump_value_to_file().

Referenced by _initialize_cli_dump().

## ◆ append_command()

static void append_command | ( | const char * | cmd,
|  | int | from_tty
| ) |  |
| static

Definition at line 138 of file cli-dump.c.

References _, all_commands, dump_cmdlist, gdb_stdout, help_list(), and printf_unfiltered().

Referenced by _initialize_cli_dump().

## ◆ bfd_openr_or_error()

static gdb_bfd_ref_ptr bfd_openr_or_error | ( | const char * | filename,
|  | const char * | target
| ) |  |
| static

Definition at line 84 of file cli-dump.c.

References _, error(), gdb_bfd_openr(), and gdb::ref_ptr< T, Policy >::get().

Referenced by restore_command().

## ◆ bfd_openw_or_error()

static gdb_bfd_ref_ptr bfd_openw_or_error | ( | const char * | filename,
|  | const char * | target,
|  | const char * | mode
| ) |  |
| static

Definition at line 98 of file cli-dump.c.

References _, error(), gdb_bfd_openw(), and gdb::ref_ptr< T, Policy >::get().

Referenced by dump_bfd_file().

## ◆ binary_append_command()

static void binary_append_command | ( | const char * | cmd,
|  | int | from_tty
| ) |  |
| static

Definition at line 616 of file cli-dump.c.

References _, all_commands, binary_append_cmdlist, gdb_stdout, help_list(), and printf_unfiltered().

Referenced by _initialize_cli_dump().

## ◆ binary_dump_command()

static void binary_dump_command | ( | const char * | cmd,
|  | int | from_tty
| ) |  |
| static

Definition at line 609 of file cli-dump.c.

References _, all_commands, binary_dump_cmdlist, gdb_stdout, help_list(), and printf_unfiltered().

Referenced by _initialize_cli_dump().

## ◆ call_dump_func()

static void call_dump_func | ( | struct cmd_list_element * | c,
|  | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 346 of file cli-dump.c.

References dump_context::func, get_cmd_context(), and dump_context::mode.

Referenced by add_dump_command().

## ◆ dump_bfd_file()

static void dump_bfd_file | ( | const char * | filename,
|  | const char * | mode,
|  | const char * | target,
|  | CORE_ADDR | vaddr,
|  | const bfd_byte * | buf,
|  | ULONGEST | len
| ) |  |
| static

Definition at line 157 of file cli-dump.c.

References _, bfd_openw_or_error(), gdb::ref_ptr< T, Policy >::get(), and warning().

Referenced by dump_memory_to_file(), and dump_value_to_file().

## ◆ dump_binary_file()

static void dump_binary_file | ( | const char * | filename,
|  | const char * | mode,
|  | const bfd_byte * | buf,
|  | ULONGEST | len
| ) |  |
| static

Definition at line 145 of file cli-dump.c.

References gdb_fopen_cloexec(), perror_with_name(), and status.

Referenced by dump_memory_to_file(), and dump_value_to_file().

## ◆ dump_binary_memory()

static void dump_binary_memory | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 316 of file cli-dump.c.

References dump_memory_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_binary_value()

static void dump_binary_value | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 322 of file cli-dump.c.

References dump_value_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_command()

static void dump_command | ( | const char * | cmd,
|  | int | from_tty
| ) |  |
| static

Definition at line 131 of file cli-dump.c.

References _, all_commands, dump_cmdlist, gdb_stdout, help_list(), and printf_unfiltered().

Referenced by _initialize_cli_dump().

## ◆ dump_ihex_memory()

static void dump_ihex_memory | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 280 of file cli-dump.c.

References dump_memory_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_ihex_value()

static void dump_ihex_value | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 286 of file cli-dump.c.

References dump_value_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_memory_command()

static void dump_memory_command | ( | const char * | cmd,
|  | const char * | mode
| ) |  |
| static

Definition at line 217 of file cli-dump.c.

References dump_memory_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_memory_to_file()

static void dump_memory_to_file | ( | const char * | cmd,
|  | const char * | mode,
|  | const char * | file_format
| ) |  |
| static

Definition at line 178 of file cli-dump.c.

References _, dump_bfd_file(), dump_binary_file(), error(), parse_and_eval_address(), read_memory(), scan_expression(), and scan_filename().

Referenced by append_binary_memory(), dump_binary_memory(), dump_ihex_memory(), dump_memory_command(), dump_srec_memory(), dump_tekhex_memory(), and dump_verilog_memory().

## ◆ dump_srec_memory()

static void dump_srec_memory | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 268 of file cli-dump.c.

References dump_memory_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_srec_value()

static void dump_srec_value | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 274 of file cli-dump.c.

References dump_value_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_tekhex_memory()

static void dump_tekhex_memory | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 304 of file cli-dump.c.

References dump_memory_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_tekhex_value()

static void dump_tekhex_value | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 310 of file cli-dump.c.

References dump_value_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_value_command()

static void dump_value_command | ( | const char * | cmd,
|  | const char * | mode
| ) |  |
| static

Definition at line 262 of file cli-dump.c.

References dump_value_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_value_to_file()

static void dump_value_to_file | ( | const char * | cmd,
|  | const char * | mode,
|  | const char * | file_format
| ) |  |
| static

Definition at line 223 of file cli-dump.c.

References _, dump_bfd_file(), dump_binary_file(), error(), parse_and_eval(), scan_filename(), TYPE_LENGTH, value_address(), value_contents(), VALUE_LVAL, value_type(), and warning().

Referenced by append_binary_value(), dump_binary_value(), dump_ihex_value(), dump_srec_value(), dump_tekhex_value(), dump_value_command(), and dump_verilog_value().

## ◆ dump_verilog_memory()

static void dump_verilog_memory | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 292 of file cli-dump.c.

References dump_memory_to_file().

Referenced by _initialize_cli_dump().

## ◆ dump_verilog_value()

static void dump_verilog_value | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 298 of file cli-dump.c.

References dump_value_to_file().

Referenced by _initialize_cli_dump().

## ◆ ihex_dump_command()

static void ihex_dump_command | ( | const char * | cmd,
|  | int | from_tty
| ) |  |
| static

Definition at line 588 of file cli-dump.c.

References _, all_commands, gdb_stdout, help_list(), ihex_cmdlist, and printf_unfiltered().

Referenced by _initialize_cli_dump().

## ◆ restore_binary_file()

static void restore_binary_file | ( | const char * | filename,
|  | struct callback_data * | data
| ) |  |
| static

Definition at line 466 of file cli-dump.c.

References _, error(), gdb_fopen_cloexec(), callback_data::load_end, callback_data::load_offset, callback_data::load_start, perror_with_name(), printf_filtered(), safe_strerror(), SEEK_SET, target_write_memory(), and warning().

Referenced by restore_command().

## ◆ restore_command()

static void restore_command | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 515 of file cli-dump.c.

References _, bfd_openr_or_error(), error(), gdb::ref_ptr< T, Policy >::get(), info_verbose, callback_data::load_end, callback_data::load_offset, callback_data::load_start, gdb.printer.bound_registers::long, noprocess(), parse_and_eval_address(), parse_and_eval_long(), printf_filtered(), restore_binary_file(), restore_section_callback(), scan_expression(), scan_filename(), skip_spaces(), startswith(), and target_has_execution.

Referenced by _initialize_cli_dump().

## ◆ restore_section_callback()

static void restore_section_callback | ( | bfd * | ibfd,
|  | asection * | isec,
|  | void * | args
| ) |  |
| static

Definition at line 402 of file cli-dump.c.

References _, error(), callback_data::load_end, callback_data::load_offset, callback_data::load_start, paddress(), printf_filtered(), puts_filtered(), safe_strerror(), size, target_gdbarch(), target_write_memory(), and warning().

Referenced by restore_command().

## ◆ scan_expression()

static gdb::unique_xmalloc_ptr<char> scan_expression | ( | const char ** | cmd,
|  | const char * | def
| ) |  |
| static

Definition at line 37 of file cli-dump.c.

References savestring(), and skip_spaces().

Referenced by dump_memory_to_file(), and restore_command().

## ◆ scan_filename()

static gdb::unique_xmalloc_ptr<char> scan_filename | ( | const char ** | cmd,
|  | const char * | defname
| ) |  |
| static

Definition at line 55 of file cli-dump.c.

References _, error(), gdb_assert, savestring(), and skip_spaces().

Referenced by dump_memory_to_file(), dump_value_to_file(), and restore_command().

## ◆ srec_dump_command()

static void srec_dump_command | ( | const char * | cmd,
|  | int | from_tty
| ) |  |
| static

Definition at line 581 of file cli-dump.c.

References _, all_commands, gdb_stdout, help_list(), printf_unfiltered(), and srec_cmdlist.

Referenced by _initialize_cli_dump().

## ◆ tekhex_dump_command()

static void tekhex_dump_command | ( | const char * | cmd,
|  | int | from_tty
| ) |  |
| static

Definition at line 602 of file cli-dump.c.

References _, all_commands, gdb_stdout, help_list(), printf_unfiltered(), and tekhex_cmdlist.

Referenced by _initialize_cli_dump().

## ◆ verilog_dump_command()

static void verilog_dump_command | ( | const char * | cmd,
|  | int | from_tty
| ) |  |
| static

Definition at line 595 of file cli-dump.c.

References _, all_commands, gdb_stdout, help_list(), printf_unfiltered(), and verilog_cmdlist.

Referenced by _initialize_cli_dump().

## Variable Documentation

## ◆ append_cmdlist

struct cmd_list_element* append_cmdlist
| static

Definition at line 122 of file cli-dump.c.

Referenced by _initialize_cli_dump(), and add_dump_command().

## ◆ binary_append_cmdlist

struct cmd_list_element* binary_append_cmdlist
| static

Definition at line 128 of file cli-dump.c.

Referenced by _initialize_cli_dump(), and binary_append_command().

## ◆ binary_dump_cmdlist

struct cmd_list_element* binary_dump_cmdlist
| static

Definition at line 127 of file cli-dump.c.

Referenced by _initialize_cli_dump(), and binary_dump_command().

## ◆ dump_cmdlist

struct cmd_list_element* dump_cmdlist
| static

Definition at line 121 of file cli-dump.c.

Referenced by _initialize_cli_dump(), add_dump_command(), append_command(), and dump_command().

## ◆ ihex_cmdlist

struct cmd_list_element* ihex_cmdlist
| static

Definition at line 124 of file cli-dump.c.

Referenced by _initialize_cli_dump(), and ihex_dump_command().

## ◆ srec_cmdlist

struct cmd_list_element* srec_cmdlist
| static

Definition at line 123 of file cli-dump.c.

Referenced by _initialize_cli_dump(), and srec_dump_command().

## ◆ tekhex_cmdlist

struct cmd_list_element* tekhex_cmdlist
| static

Definition at line 126 of file cli-dump.c.

Referenced by _initialize_cli_dump(), and tekhex_dump_command().

## ◆ verilog_cmdlist

struct cmd_list_element* verilog_cmdlist
| static

Definition at line 125 of file cli-dump.c.

Referenced by _initialize_cli_dump(), and verilog_dump_command().