aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2009-03-09 22:38:37 +0000
committerPaul Pluzhnikov <ppluzhnikov@google.com>2009-03-09 22:38:37 +0000
commit5fd1a349f04524afe86e4aa5c46390698d7901dd (patch)
treea13fb2206273feea390ea5276fb2785a0ed848ae /gdb/solib.c
parent36746093bb421cbad3a8afa2223a67565510f655 (diff)
downloadgdb-5fd1a349f04524afe86e4aa5c46390698d7901dd.zip
gdb-5fd1a349f04524afe86e4aa5c46390698d7901dd.tar.gz
gdb-5fd1a349f04524afe86e4aa5c46390698d7901dd.tar.bz2
2009-03-09 Paul Pluzhnikov <ppluzhnikov@google.com>
* solib.c (solib_contains_address_p): New function. (solib_name_from_address): Use it. * printcmd.c (display_uses_solib_p): Use it. * solib.h (solib_contains_address_p): Declare it.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index 0bd767e..0eae200 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -834,6 +834,21 @@ info_sharedlibrary_command (char *ignore, int from_tty)
}
}
+/* Return 1 if ADDRESS lies within SOLIB. */
+
+int
+solib_contains_address_p (const struct so_list *const solib,
+ CORE_ADDR address)
+{
+ struct section_table *p;
+
+ for (p = solib->sections; p < solib->sections_end; p++)
+ if (p->addr <= address && address < p->endaddr)
+ return 1;
+
+ return 0;
+}
+
/*
GLOBAL FUNCTION
@@ -862,15 +877,8 @@ solib_name_from_address (CORE_ADDR address)
struct so_list *so = 0; /* link map state variable */
for (so = so_list_head; so; so = so->next)
- {
- struct section_table *p;
-
- for (p = so->sections; p < so->sections_end; p++)
- {
- if (p->addr <= address && address < p->endaddr)
- return (so->so_name);
- }
- }
+ if (solib_contains_address_p (so, address))
+ return (so->so_name);
return (0);
}