forked from Imagelibrary/binutils-gdb
Compare commits
2 Commits
users/ARM/
...
users/palv
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
929b345a6f | ||
|
|
36dc9e2447 |
@@ -34,7 +34,6 @@
|
|||||||
#undef PACKAGE_TARNAME
|
#undef PACKAGE_TARNAME
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "bfd.h"
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ struct gdb_bfd_data
|
|||||||
needs_relocations (0),
|
needs_relocations (0),
|
||||||
crc_computed (0)
|
crc_computed (0)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
sys_stat buf;
|
||||||
|
|
||||||
if (bfd_stat (abfd, &buf) == 0)
|
if (bfd_stat (abfd, &buf) == 0)
|
||||||
{
|
{
|
||||||
@@ -355,24 +355,61 @@ gdb_bfd_iovec_fileio_close (struct bfd *abfd, void *stream)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Convert between a struct stat (potentially a gnulib replacement)
|
||||||
|
and a sys_stat (the system's struct stat). */
|
||||||
|
|
||||||
|
static sys_stat
|
||||||
|
to_sys_stat (struct stat *st)
|
||||||
|
{
|
||||||
|
sys_stat sst {};
|
||||||
|
|
||||||
|
#define COPY(FIELD) \
|
||||||
|
sst.FIELD = st->FIELD
|
||||||
|
|
||||||
|
COPY (st_dev);
|
||||||
|
COPY (st_ino);
|
||||||
|
COPY (st_mode);
|
||||||
|
COPY (st_nlink);
|
||||||
|
COPY (st_uid);
|
||||||
|
COPY (st_gid);
|
||||||
|
COPY (st_rdev);
|
||||||
|
|
||||||
|
/* Check for overflow? */
|
||||||
|
COPY (st_size);
|
||||||
|
|
||||||
|
// Should probably check _GL_WINDOWS_STAT_TIMESPEC and refer to
|
||||||
|
// st_atim, etc. instead.
|
||||||
|
COPY (st_atime);
|
||||||
|
COPY (st_mtime);
|
||||||
|
COPY (st_ctime);
|
||||||
|
|
||||||
|
#undef COPY
|
||||||
|
|
||||||
|
return sst;
|
||||||
|
}
|
||||||
|
|
||||||
/* Wrapper for target_fileio_fstat suitable for passing as the
|
/* Wrapper for target_fileio_fstat suitable for passing as the
|
||||||
STAT_FUNC argument to gdb_bfd_openr_iovec. */
|
STAT_FUNC argument to gdb_bfd_openr_iovec. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gdb_bfd_iovec_fileio_fstat (struct bfd *abfd, void *stream,
|
gdb_bfd_iovec_fileio_fstat (struct bfd *abfd, void *stream,
|
||||||
struct stat *sb)
|
sys_stat *sb)
|
||||||
{
|
{
|
||||||
int fd = *(int *) stream;
|
int fd = *(int *) stream;
|
||||||
int target_errno;
|
int target_errno;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result = target_fileio_fstat (fd, sb, &target_errno);
|
struct stat st;
|
||||||
|
|
||||||
|
result = target_fileio_fstat (fd, &st, &target_errno);
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
{
|
{
|
||||||
errno = fileio_errno_to_host (target_errno);
|
errno = fileio_errno_to_host (target_errno);
|
||||||
bfd_set_error (bfd_error_system_call);
|
bfd_set_error (bfd_error_system_call);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*sb = to_sys_stat (&st);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,7 +855,7 @@ gdb_bfd_openr_iovec (const char *filename, const char *target,
|
|||||||
void *stream),
|
void *stream),
|
||||||
int (*stat_func) (struct bfd *abfd,
|
int (*stat_func) (struct bfd *abfd,
|
||||||
void *stream,
|
void *stream,
|
||||||
struct stat *sb))
|
sys_stat *sb))
|
||||||
{
|
{
|
||||||
bfd *result = bfd_openr_iovec (filename, target,
|
bfd *result = bfd_openr_iovec (filename, target,
|
||||||
open_func, open_closure,
|
open_func, open_closure,
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ gdb_bfd_ref_ptr gdb_bfd_openr_iovec (const char *filename, const char *target,
|
|||||||
void *stream),
|
void *stream),
|
||||||
int (*stat_func) (struct bfd *abfd,
|
int (*stat_func) (struct bfd *abfd,
|
||||||
void *stream,
|
void *stream,
|
||||||
struct stat *sb));
|
sys_stat *sb));
|
||||||
|
|
||||||
/* A wrapper for bfd_openr_next_archived_file that initializes the
|
/* A wrapper for bfd_openr_next_archived_file that initializes the
|
||||||
gdb-specific reference count. */
|
gdb-specific reference count. */
|
||||||
|
|||||||
@@ -124,11 +124,11 @@ mem_bfd_iovec_pread (struct bfd *abfd, void *stream, void *buf,
|
|||||||
/* For statting the file, we only support the st_size attribute. */
|
/* For statting the file, we only support the st_size attribute. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mem_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb)
|
mem_bfd_iovec_stat (struct bfd *abfd, void *stream, sys_stat *sb)
|
||||||
{
|
{
|
||||||
struct target_buffer *buffer = (struct target_buffer*) stream;
|
struct target_buffer *buffer = (struct target_buffer*) stream;
|
||||||
|
|
||||||
memset (sb, 0, sizeof (struct stat));
|
memset (sb, 0, sizeof (sys_stat));
|
||||||
sb->st_size = buffer->size;
|
sb->st_size = buffer->size;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1260,7 +1260,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
|
|||||||
{
|
{
|
||||||
unsigned long file_crc;
|
unsigned long file_crc;
|
||||||
int file_crc_p;
|
int file_crc_p;
|
||||||
struct stat parent_stat, abfd_stat;
|
sys_stat parent_stat, abfd_stat;
|
||||||
int verified_as_different;
|
int verified_as_different;
|
||||||
|
|
||||||
/* Find a separate debug info file as if symbols would be present in
|
/* Find a separate debug info file as if symbols would be present in
|
||||||
|
|||||||
@@ -32,8 +32,21 @@ typedef unsigned long long ULONGEST;
|
|||||||
|
|
||||||
#else /* GDBSERVER */
|
#else /* GDBSERVER */
|
||||||
|
|
||||||
|
/* Gnulib may replace struct stat with its own version. Bfd does not
|
||||||
|
use gnulib, so when we call into bfd, we must use the system struct
|
||||||
|
stat. */
|
||||||
|
#define __need_system_sys_stat_h 1
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
|
|
||||||
|
typedef struct stat sys_stat;
|
||||||
|
|
||||||
|
#undef __need_system_sys_stat_h
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
/* * A byte from the program being debugged. */
|
/* * A byte from the program being debugged. */
|
||||||
typedef bfd_byte gdb_byte;
|
typedef bfd_byte gdb_byte;
|
||||||
|
|
||||||
|
|||||||
@@ -536,40 +536,6 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if @GNULIB_LSTAT@
|
|
||||||
# if ! @HAVE_LSTAT@
|
|
||||||
/* mingw does not support symlinks, therefore it does not have lstat. But
|
|
||||||
without links, stat does just fine. */
|
|
||||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
||||||
# define lstat stat
|
|
||||||
# endif
|
|
||||||
_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
|
|
||||||
# elif @REPLACE_LSTAT@
|
|
||||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
||||||
# undef lstat
|
|
||||||
# define lstat rpl_lstat
|
|
||||||
# endif
|
|
||||||
_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
|
|
||||||
_GL_ARG_NONNULL ((1, 2)));
|
|
||||||
_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
|
|
||||||
# else
|
|
||||||
_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
|
|
||||||
# endif
|
|
||||||
# if @HAVE_LSTAT@
|
|
||||||
_GL_CXXALIASWARN (lstat);
|
|
||||||
# endif
|
|
||||||
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
|
|
||||||
# undef lstat
|
|
||||||
# define lstat lstat_used_without_requesting_gnulib_module_lstat
|
|
||||||
#elif defined GNULIB_POSIXCHECK
|
|
||||||
# undef lstat
|
|
||||||
# if HAVE_RAW_DECL_LSTAT
|
|
||||||
_GL_WARN_ON_USE (lstat, "lstat is unportable - "
|
|
||||||
"use gnulib module lstat for portability");
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if @REPLACE_MKDIR@
|
#if @REPLACE_MKDIR@
|
||||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
# undef mkdir
|
# undef mkdir
|
||||||
@@ -781,6 +747,38 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if @GNULIB_LSTAT@
|
||||||
|
# if ! @HAVE_LSTAT@
|
||||||
|
/* mingw does not support symlinks, therefore it does not have lstat. But
|
||||||
|
without links, stat does just fine. */
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# define lstat stat
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
|
||||||
|
# elif @REPLACE_LSTAT@
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# undef lstat
|
||||||
|
# define lstat rpl_lstat
|
||||||
|
# endif
|
||||||
|
_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
|
||||||
|
_GL_ARG_NONNULL ((1, 2)));
|
||||||
|
_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
|
||||||
|
# else
|
||||||
|
_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
|
||||||
|
# endif
|
||||||
|
# if @HAVE_LSTAT@
|
||||||
|
_GL_CXXALIASWARN (lstat);
|
||||||
|
# endif
|
||||||
|
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
|
||||||
|
# undef lstat
|
||||||
|
# define lstat lstat_used_without_requesting_gnulib_module_lstat
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
# undef lstat
|
||||||
|
# if HAVE_RAW_DECL_LSTAT
|
||||||
|
_GL_WARN_ON_USE (lstat, "lstat is unportable - "
|
||||||
|
"use gnulib module lstat for portability");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if @GNULIB_UTIMENSAT@
|
#if @GNULIB_UTIMENSAT@
|
||||||
/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
|
/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
|
||||||
|
|||||||
Reference in New Issue
Block a user