X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fcorefile.c;h=c1eec199342adc3afe50981b5820e34572029b13;hb=c20cb6860c27d6ef15a1e561f4be78e7b85952ac;hp=4fe8606a22dec09f922058d6ed1a37422e406b30;hpb=268a13a5a3f7c6b9b6ffc5ac2d1b24eb41f3fbdc;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/corefile.c b/gdb/corefile.c index 4fe8606a22..c1eec19934 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -1,6 +1,6 @@ /* Core dump and executable file functions above target vector, for GDB. - Copyright (C) 1986-2019 Free Software Foundation, Inc. + Copyright (C) 1986-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -32,6 +32,7 @@ #include "completer.h" #include "observable.h" #include "cli/cli-utils.h" +#include "gdbarch.h" /* You can have any number of hooks for `exec_file_command' command to call. If there's only one hook, it is set in exec_file_display @@ -140,17 +141,16 @@ validate_files (void) /* See gdbsupport/common-inferior.h. */ -char * +const char * get_exec_file (int err) { - if (exec_filename) - return exec_filename; + if (current_program_space->exec_filename != nullptr) + return current_program_space->exec_filename.get (); if (!err) return NULL; error (_("No executable file specified.\n\ Use the \"file\" or \"exec-file\" command.")); - return NULL; } @@ -328,33 +328,6 @@ read_code_unsigned_integer (CORE_ADDR memaddr, int len, return extract_unsigned_integer (buf, len, byte_order); } -void -read_memory_string (CORE_ADDR memaddr, char *buffer, int max_len) -{ - char *cp; - int i; - int cnt; - - cp = buffer; - while (1) - { - if (cp - buffer >= max_len) - { - buffer[max_len - 1] = '\0'; - break; - } - cnt = max_len - (cp - buffer); - if (cnt > 8) - cnt = 8; - read_memory (memaddr + (int) (cp - buffer), (gdb_byte *) cp, cnt); - for (i = 0; i < cnt && *cp; i++, cp++) - ; /* null body */ - - if (i < cnt && !*cp) - break; - } -} - CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type) { @@ -415,7 +388,7 @@ write_memory_signed_integer (CORE_ADDR addr, int len, /* The current default bfd target. Points to storage allocated for gnutarget_string. */ -char *gnutarget; +const char *gnutarget; /* Same thing, except it is "auto" not NULL for the default case. */ static char *gnutarget_string; @@ -472,14 +445,14 @@ complete_set_gnutarget (struct cmd_list_element *cmd, void set_gnutarget (const char *newtarget) { - if (gnutarget_string != NULL) - xfree (gnutarget_string); + xfree (gnutarget_string); gnutarget_string = xstrdup (newtarget); set_gnutarget_command (NULL, 0, NULL); } +void _initialize_core (); void -_initialize_core (void) +_initialize_core () { struct cmd_list_element *c;