GDB (xrefs)

Macros | Functions
/tmp/gdb-8.1/gdb/gcore.c File Reference
`#include "defs.h"`
`#include "elf-bfd.h"`
`#include "infcall.h"`
`#include "inferior.h"`
`#include "gdbcore.h"`
`#include "objfiles.h"`
`#include "solib.h"`
`#include "symfile.h"`
`#include "arch-utils.h"`
`#include "completer.h"`
`#include "gcore.h"`
`#include "cli/cli-decode.h"`
`#include <fcntl.h>`
`#include "regcache.h"`
`#include "regset.h"`
`#include "gdb_bfd.h"`
`#include "readline/tilde.h"`
`#include <algorithm>`
`#include "common/gdb_unlinker.h"`
`#include "byte-vector.h"`

Go to the source code of this file.

## Macros
#define | MAX_COPY_BYTES (1024 * 1024)

## Functions
static const char * | default_gcore_target (void)
static enum bfd_architecture | default_gcore_arch (void)
static unsigned long | default_gcore_mach (void)
static int | gcore_memory_sections (bfd *)
gdb_bfd_ref_ptr | create_gcore_bfd (const char *filename)
static void | write_gcore_file_1 (bfd *obfd)
void | write_gcore_file (bfd *obfd)
static void | gcore_command (const char *args, int from_tty)
static int | derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
static bfd_vma | call_target_sbrk (int sbrk_arg)
static int | derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
static void | make_output_phdrs (bfd *obfd, asection *osec, void *ignored)
static int | gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read, int write, int exec, int modified, void *data)
int | objfile_find_memory_regions (struct target_ops *self, find_memory_region_ftype func, void *obfd)
static void | gcore_copy_callback (bfd *obfd, asection *osec, void *ignored)
void | _initialize_gcore (void)

## Macro Definition Documentation

## ◆ MAX_COPY_BYTES

#define MAX_COPY_BYTES (1024 * 1024)

Definition at line 44 of file gcore.c.

Referenced by gcore_copy_callback().

## Function Documentation

## ◆ _initialize_gcore()

void _initialize_gcore | ( | void |  | ) |

Definition at line 610 of file gcore.c.

References _, add_com(), add_com_alias(), class_files, and gcore_command().

## ◆ call_target_sbrk()

static bfd_vma call_target_sbrk | ( | int | sbrk_arg | ) |
| static

Definition at line 275 of file gcore.c.

References call_function_by_hand(), find_function_in_inferior(), gdb_assert, get_objfile_arch(), lookup_minimal_symbol(), value_as_long(), and value_from_longest().

Referenced by derive_heap_segment().

## ◆ create_gcore_bfd()

gdb_bfd_ref_ptr create_gcore_bfd | ( | const char * | filename | ) |

Definition at line 55 of file gcore.c.

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

Referenced by gcore_command(), and record_full_save().

## ◆ default_gcore_arch()

static enum bfd_architecture default_gcore_arch | ( | void |  | ) |
| static

Definition at line 196 of file gcore.c.

References _, error(), exec_bfd, gdbarch_bfd_arch_info(), and target_gdbarch().

Referenced by create_gcore_bfd().

## ◆ default_gcore_mach()

static unsigned long default_gcore_mach | ( | void |  | ) |
| static

Definition at line 178 of file gcore.c.

References _, error(), exec_bfd, gdbarch_bfd_arch_info(), and target_gdbarch().

Referenced by create_gcore_bfd().

## ◆ default_gcore_target()

static const char * default_gcore_target | ( | void |  | ) |
| static

Definition at line 209 of file gcore.c.

References exec_bfd, gdbarch_gcore_bfd_target(), gdbarch_gcore_bfd_target_p(), and target_gdbarch().

Referenced by create_gcore_bfd().

## ◆ derive_heap_segment()

static int derive_heap_segment | ( | bfd * | abfd,
|  | bfd_vma * | bottom,
|  | bfd_vma * | top
| ) |  |
| static

Definition at line 320 of file gcore.c.

References call_target_sbrk(), gdb_assert, and target_has_execution.

Referenced by objfile_find_memory_regions().

## ◆ derive_stack_segment()

static int derive_stack_segment | ( | bfd_vma * | bottom,
|  | bfd_vma * | top
| ) |  |
| static

Definition at line 228 of file gcore.c.

References gdb_assert, gdbarch_inner_than(), get_current_frame(), get_frame_arch(), get_frame_base(), get_frame_sp(), get_prev_frame(), target_has_registers, and target_has_stack.

Referenced by objfile_find_memory_regions().

## ◆ gcore_command()

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

Definition at line 141 of file gcore.c.

References create_gcore_bfd(), fprintf_filtered(), gdb_stdout, inferior_ptid, info_verbose, noprocess(), ptid_get_pid(), target_has_execution, write_gcore_file(), and xstrprintf().

Referenced by _initialize_gcore().

## ◆ gcore_copy_callback()

static void gcore_copy_callback | ( | bfd * | obfd,
|  | asection * | osec,
|  | void * | ignored
| ) |  |
| static

Definition at line 545 of file gcore.c.

References _, MAX_COPY_BYTES, offset, paddress(), plongest(), size, startswith(), target_gdbarch(), target_read_memory(), and warning().

Referenced by gcore_memory_sections().

## ◆ gcore_create_callback()

static int gcore_create_callback | ( | CORE_ADDR | vaddr,
|  | unsigned long | size,
|  | int | read,
|  | int | write,
|  | int | exec,
|  | int | modified,
|  | void * | data
| ) |  |
| static

Definition at line 402 of file gcore.c.

References _, ALL_OBJSECTIONS, flags, fprintf_filtered(), gdb_stdout, info_verbose, objfile::obfd, obj_section_addr, obj_section_endaddr, objfile::objfile(), paddress(), plongest(), read(), objfile::separate_debug_objfile_backlink, size, solib_keep_data_in_core(), target_gdbarch(), obj_section::the_bfd_section, and warning().

Referenced by gcore_memory_sections().

## ◆ gcore_memory_sections()

static int gcore_memory_sections | ( | bfd * | obfd | ) |
| static

Definition at line 589 of file gcore.c.

References gcore_copy_callback(), gcore_create_callback(), gdbarch_find_memory_regions(), gdbarch_find_memory_regions_p(), make_output_phdrs(), target_find_memory_regions, and target_gdbarch().

Referenced by write_gcore_file_1().

## ◆ make_output_phdrs()

static void make_output_phdrs | ( | bfd * | obfd,
|  | asection * | osec,
|  | void * | ignored
| ) |  |
| static

Definition at line 376 of file gcore.c.

References startswith().

Referenced by gcore_memory_sections().

## ◆ objfile_find_memory_regions()

int objfile_find_memory_regions | ( | struct target_ops * | self,
|  | find_memory_region_ftype | func,
|  | void * | obfd
| ) |  |

Definition at line 488 of file gcore.c.

References ALL_OBJSECTIONS, derive_heap_segment(), derive_stack_segment(), exec_bfd, flags, func, objfile::obfd, obj_section_addr, objfile::objfile(), objfile::separate_debug_objfile_backlink, size, and obj_section::the_bfd_section.

Referenced by init_exec_ops().

## ◆ write_gcore_file()

void write_gcore_file | ( | bfd * | obfd | ) |

Definition at line 115 of file gcore.c.

References CATCH, END_CATCH, exception_none, gdb_exception::reason, RETURN_MASK_ALL, target_done_generating_core(), target_prepare_to_generate_core(), throw_exception(), TRY, and write_gcore_file_1().

Referenced by gcore_command(), and record_full_save().

## ◆ write_gcore_file_1()

static void write_gcore_file_1 | ( | bfd * | obfd | ) |
| static

Definition at line 69 of file gcore.c.

References _, error(), gcore_memory_sections(), gdbarch_make_corefile_notes(), gdbarch_make_corefile_notes_p(), target_gdbarch(), target_make_corefile_notes, and warning().

Referenced by write_gcore_file().