aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2010-04-20 22:35:03 +0000
committerJoel Brobecker <brobecker@gnat.com>2010-04-20 22:35:03 +0000
commite294797a886401059bdfbc51228390b40cebe4d5 (patch)
treefd5bba62d3421c85ceffff506831a9025f0b88af /gdb
parenta223f1e7a0d0c668e1bfbadbf5c3e3159b31cbf1 (diff)
downloadgdb-e294797a886401059bdfbc51228390b40cebe4d5.zip
gdb-e294797a886401059bdfbc51228390b40cebe4d5.tar.gz
gdb-e294797a886401059bdfbc51228390b40cebe4d5.tar.bz2
procfs.c: Move solib_mappings_callback up to avoid compiler warning.
There are currently 2 issues with the placement of this routine: - It's defined after it is being used (causing an implicit declaration); - It looks like it's being defined all the time, whereas it is used only on mips-irix (AFAICT) - shouldn't have this triggered a warning on sparc-solaris, for instance??? In any case, this patch moves this function up, inside the right region, just before the function where it is actually used. gdb/ChangeLog: * procfs.c (solib_mappings_callback): Move function up to avoid a compiler warning.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/procfs.c98
2 files changed, 52 insertions, 51 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9654678..50caa17 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2010-04-20 Joel Brobecker <brobecker@adacore.com>
+ * procfs.c (solib_mappings_callback): Move function up to avoid
+ a compiler warning.
+
+2010-04-20 Joel Brobecker <brobecker@adacore.com>
+
* procfs.c (find_signalled_thread, find_stop_signal): Move
these functions down to define them only when used.
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 0ee72dc..a04b604 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -4043,6 +4043,53 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
return 0;
}
+/* Calls the supplied callback function once for each mapped address
+ space in the process. The callback function receives an open
+ file descriptor for the file corresponding to that mapped
+ address space (if there is one), and the base address of the
+ mapped space. Quit when the callback function returns a
+ nonzero value, or at teh end of the mappings.
+
+ Returns: the first non-zero return value of the callback function,
+ or zero. */
+
+static int
+solib_mappings_callback (struct prmap *map, int (*func) (int, CORE_ADDR),
+ void *data)
+{
+ procinfo *pi = data;
+ int fd;
+
+#ifdef NEW_PROC_API
+ char name[MAX_PROC_NAME_SIZE + sizeof (map->pr_mapname)];
+
+ if (map->pr_vaddr == 0 && map->pr_size == 0)
+ return -1; /* sanity */
+
+ if (map->pr_mapname[0] == 0)
+ {
+ fd = -1; /* no map file */
+ }
+ else
+ {
+ sprintf (name, "/proc/%d/object/%s", pi->pid, map->pr_mapname);
+ /* Note: caller's responsibility to close this fd! */
+ fd = open_with_retry (name, O_RDONLY);
+ /* Note: we don't test the above call for failure;
+ we just pass the FD on as given. Sometimes there is
+ no file, so the open may return failure, but that's
+ not a problem. */
+ }
+#else
+ fd = ioctl (pi->ctl_fd, PIOCOPENM, &map->pr_vaddr);
+ /* Note: we don't test the above call for failure;
+ we just pass the FD on as given. Sometimes there is
+ no file, so the ioctl may return failure, but that's
+ not a problem. */
+#endif
+ return (*func) (fd, (CORE_ADDR) map->pr_vaddr);
+}
+
/* If the given memory region MAP contains a symbol named __dbx_link,
insert a breakpoint at this location and return nonzero. Return
zero otherwise. */
@@ -5624,57 +5671,6 @@ iterate_over_mappings (procinfo *pi, int (*child_func) (), void *data,
}
/*
- * Function: solib_mappings_callback
- *
- * Calls the supplied callback function once for each mapped address
- * space in the process. The callback function receives an open
- * file descriptor for the file corresponding to that mapped
- * address space (if there is one), and the base address of the
- * mapped space. Quit when the callback function returns a
- * nonzero value, or at teh end of the mappings.
- *
- * Returns: the first non-zero return value of the callback function,
- * or zero.
- */
-
-int solib_mappings_callback (struct prmap *map,
- int (*func) (int, CORE_ADDR),
- void *data)
-{
- procinfo *pi = data;
- int fd;
-
-#ifdef NEW_PROC_API
- char name[MAX_PROC_NAME_SIZE + sizeof (map->pr_mapname)];
-
- if (map->pr_vaddr == 0 && map->pr_size == 0)
- return -1; /* sanity */
-
- if (map->pr_mapname[0] == 0)
- {
- fd = -1; /* no map file */
- }
- else
- {
- sprintf (name, "/proc/%d/object/%s", pi->pid, map->pr_mapname);
- /* Note: caller's responsibility to close this fd! */
- fd = open_with_retry (name, O_RDONLY);
- /* Note: we don't test the above call for failure;
- we just pass the FD on as given. Sometimes there is
- no file, so the open may return failure, but that's
- not a problem. */
- }
-#else
- fd = ioctl (pi->ctl_fd, PIOCOPENM, &map->pr_vaddr);
- /* Note: we don't test the above call for failure;
- we just pass the FD on as given. Sometimes there is
- no file, so the ioctl may return failure, but that's
- not a problem. */
-#endif
- return (*func) (fd, (CORE_ADDR) map->pr_vaddr);
-}
-
-/*
* Function: find_memory_regions_callback
*
* Implements the to_find_memory_regions method.