/* Dump-to-file commands, for GDB, the GNU debugger.
- Copyright (C) 2002-2018 Free Software Foundation, Inc.
+ Copyright (C) 2002-2019 Free Software Foundation, Inc.
Contributed by Red Hat.
#include "gdbcore.h"
#include "cli/cli-utils.h"
#include "gdb_bfd.h"
-#include "filestuff.h"
+#include "common/filestuff.h"
#include "common/byte-vector.h"
static gdb::unique_xmalloc_ptr<char>
scan_expression (const char **cmd, const char *def)
{
if ((*cmd) == NULL || (**cmd) == '\0')
- return gdb::unique_xmalloc_ptr<char> (xstrdup (def));
+ return make_unique_xstrdup (def);
else
{
char *exp;
gdb_file_up file = gdb_fopen_cloexec (filename, FOPEN_RB);
long len;
+ if (file == NULL)
+ error (_("Failed to open %s: %s"), filename, safe_strerror (errno));
+
/* Get the file size for reading. */
if (fseek (file.get (), 0, SEEK_END) == 0)
{