aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-tdep.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-06-10 14:28:43 +0100
committerGary Benson <gbenson@redhat.com>2015-06-10 14:28:43 +0100
commit07c138c8ae2b11d417c9799202363a95a2d06881 (patch)
treef9e4e351dd13738a439fbf69f75c06b5e9c38dc3 /gdb/linux-tdep.c
parent12e2a5fdccfc6857c57d2e0a1c1e5fd136a94025 (diff)
downloadgdb-07c138c8ae2b11d417c9799202363a95a2d06881.zip
gdb-07c138c8ae2b11d417c9799202363a95a2d06881.tar.gz
gdb-07c138c8ae2b11d417c9799202363a95a2d06881.tar.bz2
Add "inferior" argument to some target_fileio functions
This commit adds a new argument to all target_fileio functions with filename arguments to allow the desired inferior to be specified. This allows GDB to support systems where processes do not necessarily share a common filesystem. gdb/ChangeLog: * target.h (struct inferior): New forward declaration. (struct target_ops) <to_filesystem_is_local>: Update comment. (struct target_ops) <to_fileio_open>: New argument inf. Update comment. All implementations updated. (struct target_ops) <to_fileio_unlink>: Likewise. (struct target_ops) <to_fileio_readlink>: Likewise. (target_filesystem_is_local): Update comment. (target_fileio_open): New argument inf. Update comment. (target_fileio_unlink): Likewise. (target_fileio_readlink): Likewise. (target_fileio_read_alloc): Likewise. (target_fileio_read_stralloc): Likewise. * target.c (target_fileio_open): New argument inf. Pass inf to implementation. Update debug printing. (target_fileio_unlink): Likewise. (target_fileio_readlink): Likewise. (target_fileio_read_alloc_1): New argument inf. Pass inf to target_fileio_open. (target_fileio_read_alloc): New argument inf. Pass inf to target_fileio_read_alloc_1. (target_fileio_read_stralloc): Likewise. * gdb_bfd.c (inferior.h): New include. (gdb_bfd_iovec_fileio_open): Replace unused "open_closure" argument with new argument "inferior". Pass inferior to target_fileio_open. (gdb_bfd_open): Supply inferior argument to gdb_bfd_iovec_fileio_open. * linux-tdep.c (linux_info_proc): Supply inf argument to relevant target_fileio calls. (linux_find_memory_regions_full): Likewise. (linux_fill_prpsinfo): Likewise. * remote.c (remote_filesystem_is_local): Supply inf argument to remote_hostio_open. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_file_delete): Supply inf argument to remote_hostio_unlink.
Diffstat (limited to 'gdb/linux-tdep.c')
-rw-r--r--gdb/linux-tdep.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 8ce2f34..f0cdc9c 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -719,7 +719,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (cmdline_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/cmdline", pid);
- data = target_fileio_read_stralloc (filename);
+ data = target_fileio_read_stralloc (NULL, filename);
if (data)
{
struct cleanup *cleanup = make_cleanup (xfree, data);
@@ -732,7 +732,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (cwd_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/cwd", pid);
- data = target_fileio_readlink (filename, &target_errno);
+ data = target_fileio_readlink (NULL, filename, &target_errno);
if (data)
{
struct cleanup *cleanup = make_cleanup (xfree, data);
@@ -745,7 +745,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (exe_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/exe", pid);
- data = target_fileio_readlink (filename, &target_errno);
+ data = target_fileio_readlink (NULL, filename, &target_errno);
if (data)
{
struct cleanup *cleanup = make_cleanup (xfree, data);
@@ -758,7 +758,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (mappings_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/maps", pid);
- data = target_fileio_read_stralloc (filename);
+ data = target_fileio_read_stralloc (NULL, filename);
if (data)
{
struct cleanup *cleanup = make_cleanup (xfree, data);
@@ -819,7 +819,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (status_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/status", pid);
- data = target_fileio_read_stralloc (filename);
+ data = target_fileio_read_stralloc (NULL, filename);
if (data)
{
struct cleanup *cleanup = make_cleanup (xfree, data);
@@ -832,7 +832,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (stat_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/stat", pid);
- data = target_fileio_read_stralloc (filename);
+ data = target_fileio_read_stralloc (NULL, filename);
if (data)
{
struct cleanup *cleanup = make_cleanup (xfree, data);
@@ -1134,7 +1134,8 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
{
xsnprintf (coredumpfilter_name, sizeof (coredumpfilter_name),
"/proc/%d/coredump_filter", pid);
- coredumpfilterdata = target_fileio_read_stralloc (coredumpfilter_name);
+ coredumpfilterdata = target_fileio_read_stralloc (NULL,
+ coredumpfilter_name);
if (coredumpfilterdata != NULL)
{
sscanf (coredumpfilterdata, "%x", &filterflags);
@@ -1143,12 +1144,12 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
}
xsnprintf (mapsfilename, sizeof mapsfilename, "/proc/%d/smaps", pid);
- data = target_fileio_read_stralloc (mapsfilename);
+ data = target_fileio_read_stralloc (NULL, mapsfilename);
if (data == NULL)
{
/* Older Linux kernels did not support /proc/PID/smaps. */
xsnprintf (mapsfilename, sizeof mapsfilename, "/proc/%d/maps", pid);
- data = target_fileio_read_stralloc (mapsfilename);
+ data = target_fileio_read_stralloc (NULL, mapsfilename);
}
if (data != NULL)
@@ -1755,7 +1756,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
/* Obtaining PID and filename. */
pid = ptid_get_pid (inferior_ptid);
xsnprintf (filename, sizeof (filename), "/proc/%d/cmdline", (int) pid);
- fname = target_fileio_read_stralloc (filename);
+ fname = target_fileio_read_stralloc (NULL, filename);
if (fname == NULL || *fname == '\0')
{
@@ -1788,7 +1789,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
p->pr_psargs[sizeof (p->pr_psargs) - 1] = '\0';
xsnprintf (filename, sizeof (filename), "/proc/%d/stat", (int) pid);
- proc_stat = target_fileio_read_stralloc (filename);
+ proc_stat = target_fileio_read_stralloc (NULL, filename);
make_cleanup (xfree, proc_stat);
if (proc_stat == NULL || *proc_stat == '\0')
@@ -1869,7 +1870,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
/* Finally, obtaining the UID and GID. For that, we read and parse the
contents of the `/proc/PID/status' file. */
xsnprintf (filename, sizeof (filename), "/proc/%d/status", (int) pid);
- proc_status = target_fileio_read_stralloc (filename);
+ proc_status = target_fileio_read_stralloc (NULL, filename);
make_cleanup (xfree, proc_status);
if (proc_status == NULL || *proc_status == '\0')