aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2010-01-28 08:19:29 +0000
committerJoel Brobecker <brobecker@gnat.com>2010-01-28 08:19:29 +0000
commit7434dadd5d36ea431f851b4e3a28b248f3b2c817 (patch)
treeb684eeda1c4fa3c3ed7de1be06f3dbc45bd8742f
parent3c9177f19363580c5888915fa3a0f2b6591c2b20 (diff)
downloadgdb-7434dadd5d36ea431f851b4e3a28b248f3b2c817.zip
gdb-7434dadd5d36ea431f851b4e3a28b248f3b2c817.tar.gz
gdb-7434dadd5d36ea431f851b4e3a28b248f3b2c817.tar.bz2
Another -Wunused-function error in procfs.c (sparc-solaris)
* procfs.c (insert_dbx_link_breakpoint): Delete declaration. Move up. Only define if SYS_syssgi is defined. (remove_dbx_link_breakpoint): Delete declaration. Move up. (dbx_link_addr, insert_dbx_link_bpt_in_file) (insert_dbx_link_bpt_in_region): Move up. Only define if SYS_syssgi is itself defined.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/procfs.c258
2 files changed, 139 insertions, 129 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0c6d99f..db65d6d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2010-01-28 Joel Brobecker <brobecker@adacore.com>
+
+ Another -Wunused-function error in procfs.c (sparc-solaris)
+ * procfs.c (insert_dbx_link_breakpoint): Delete declaration. Move up.
+ Only define if SYS_syssgi is defined.
+ (remove_dbx_link_breakpoint): Delete declaration. Move up.
+ (dbx_link_addr, insert_dbx_link_bpt_in_file)
+ (insert_dbx_link_bpt_in_region): Move up. Only define if SYS_syssgi
+ is itself defined.
+
2010-01-27 Christopher Faylor <me+cygwin@cgf.cx>
* windows-nat.c (windows_initialization_done): New variable.
diff --git a/gdb/procfs.c b/gdb/procfs.c
index c6f50d2..1dd39b2 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -3463,8 +3463,6 @@ static void do_detach (int signo);
static int register_gdb_signals (procinfo *, gdb_sigset_t *);
static void proc_trace_syscalls_1 (procinfo *pi, int syscallnum,
int entry_or_exit, int mode, int from_tty);
-static int insert_dbx_link_breakpoint (procinfo *pi);
-static void remove_dbx_link_breakpoint (void);
/* On mips-irix, we need to insert a breakpoint at __dbx_link during
the startup phase. The following two variables are used to record
@@ -3948,6 +3946,135 @@ syscall_is_lwp_create (procinfo *pi, int scall)
return 0;
}
+/* Remove the breakpoint that we inserted in __dbx_link().
+ Does nothing if the breakpoint hasn't been inserted or has already
+ been removed. */
+
+static void
+remove_dbx_link_breakpoint (void)
+{
+ if (dbx_link_bpt_addr == 0)
+ return;
+
+ if (deprecated_remove_raw_breakpoint (target_gdbarch, dbx_link_bpt) != 0)
+ warning (_("Unable to remove __dbx_link breakpoint."));
+
+ dbx_link_bpt_addr = 0;
+ dbx_link_bpt = NULL;
+}
+
+#ifdef SYS_syssgi
+/* Return the address of the __dbx_link() function in the file
+ refernced by ABFD by scanning its symbol table. Return 0 if
+ the symbol was not found. */
+
+static CORE_ADDR
+dbx_link_addr (bfd *abfd)
+{
+ long storage_needed;
+ asymbol **symbol_table;
+ long number_of_symbols;
+ long i;
+
+ storage_needed = bfd_get_symtab_upper_bound (abfd);
+ if (storage_needed <= 0)
+ return 0;
+
+ symbol_table = (asymbol **) xmalloc (storage_needed);
+ make_cleanup (xfree, symbol_table);
+
+ number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
+
+ for (i = 0; i < number_of_symbols; i++)
+ {
+ asymbol *sym = symbol_table[i];
+
+ if ((sym->flags & BSF_GLOBAL)
+ && sym->name != NULL && strcmp (sym->name, "__dbx_link") == 0)
+ return (sym->value + sym->section->vma);
+ }
+
+ /* Symbol not found, return NULL. */
+ return 0;
+}
+
+/* Search the symbol table of the file referenced by FD for a symbol
+ named __dbx_link(). If found, then insert a breakpoint at this location,
+ and return nonzero. Return zero otherwise. */
+
+static int
+insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
+{
+ bfd *abfd;
+ long storage_needed;
+ CORE_ADDR sym_addr;
+
+ abfd = bfd_fdopenr ("unamed", 0, fd);
+ if (abfd == NULL)
+ {
+ warning (_("Failed to create a bfd: %s."), bfd_errmsg (bfd_get_error ()));
+ return 0;
+ }
+
+ if (!bfd_check_format (abfd, bfd_object))
+ {
+ /* Not the correct format, so we can not possibly find the dbx_link
+ symbol in it. */
+ bfd_close (abfd);
+ return 0;
+ }
+
+ sym_addr = dbx_link_addr (abfd);
+ if (sym_addr != 0)
+ {
+ /* Insert the breakpoint. */
+ dbx_link_bpt_addr = sym_addr;
+ dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch, NULL,
+ sym_addr);
+ if (dbx_link_bpt == NULL)
+ {
+ warning (_("Failed to insert dbx_link breakpoint."));
+ bfd_close (abfd);
+ return 0;
+ }
+ bfd_close (abfd);
+ return 1;
+ }
+
+ bfd_close (abfd);
+ return 0;
+}
+
+/* If the given memory region MAP contains a symbol named __dbx_link,
+ insert a breakpoint at this location and return nonzero. Return
+ zero otherwise. */
+
+static int
+insert_dbx_link_bpt_in_region (struct prmap *map,
+ int (*child_func) (),
+ void *data)
+{
+ procinfo *pi = (procinfo *) data;
+
+ /* We know the symbol we're looking for is in a text region, so
+ only look for it if the region is a text one. */
+ if (map->pr_mflags & MA_EXEC)
+ return solib_mappings_callback (map, insert_dbx_link_bpt_in_file, pi);
+
+ return 0;
+}
+
+/* Search all memory regions for a symbol named __dbx_link. If found,
+ insert a breakpoint at its location, and return nonzero. Return zero
+ otherwise. */
+
+static int
+insert_dbx_link_breakpoint (procinfo *pi)
+{
+ return iterate_over_mappings (pi, NULL, pi, insert_dbx_link_bpt_in_region);
+}
+#endif
+
/*
* Function: target_wait
*
@@ -5608,133 +5735,6 @@ proc_find_memory_regions (int (*func) (CORE_ADDR,
find_memory_regions_callback);
}
-/* Remove the breakpoint that we inserted in __dbx_link().
- Does nothing if the breakpoint hasn't been inserted or has already
- been removed. */
-
-static void
-remove_dbx_link_breakpoint (void)
-{
- if (dbx_link_bpt_addr == 0)
- return;
-
- if (deprecated_remove_raw_breakpoint (target_gdbarch, dbx_link_bpt) != 0)
- warning (_("Unable to remove __dbx_link breakpoint."));
-
- dbx_link_bpt_addr = 0;
- dbx_link_bpt = NULL;
-}
-
-/* Return the address of the __dbx_link() function in the file
- refernced by ABFD by scanning its symbol table. Return 0 if
- the symbol was not found. */
-
-static CORE_ADDR
-dbx_link_addr (bfd *abfd)
-{
- long storage_needed;
- asymbol **symbol_table;
- long number_of_symbols;
- long i;
-
- storage_needed = bfd_get_symtab_upper_bound (abfd);
- if (storage_needed <= 0)
- return 0;
-
- symbol_table = (asymbol **) xmalloc (storage_needed);
- make_cleanup (xfree, symbol_table);
-
- number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
-
- for (i = 0; i < number_of_symbols; i++)
- {
- asymbol *sym = symbol_table[i];
-
- if ((sym->flags & BSF_GLOBAL)
- && sym->name != NULL && strcmp (sym->name, "__dbx_link") == 0)
- return (sym->value + sym->section->vma);
- }
-
- /* Symbol not found, return NULL. */
- return 0;
-}
-
-/* Search the symbol table of the file referenced by FD for a symbol
- named __dbx_link(). If found, then insert a breakpoint at this location,
- and return nonzero. Return zero otherwise. */
-
-static int
-insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
-{
- bfd *abfd;
- long storage_needed;
- CORE_ADDR sym_addr;
-
- abfd = bfd_fdopenr ("unamed", 0, fd);
- if (abfd == NULL)
- {
- warning (_("Failed to create a bfd: %s."), bfd_errmsg (bfd_get_error ()));
- return 0;
- }
-
- if (!bfd_check_format (abfd, bfd_object))
- {
- /* Not the correct format, so we can not possibly find the dbx_link
- symbol in it. */
- bfd_close (abfd);
- return 0;
- }
-
- sym_addr = dbx_link_addr (abfd);
- if (sym_addr != 0)
- {
- /* Insert the breakpoint. */
- dbx_link_bpt_addr = sym_addr;
- dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch, NULL,
- sym_addr);
- if (dbx_link_bpt == NULL)
- {
- warning (_("Failed to insert dbx_link breakpoint."));
- bfd_close (abfd);
- return 0;
- }
- bfd_close (abfd);
- return 1;
- }
-
- bfd_close (abfd);
- return 0;
-}
-
-/* If the given memory region MAP contains a symbol named __dbx_link,
- insert a breakpoint at this location and return nonzero. Return
- zero otherwise. */
-
-static int
-insert_dbx_link_bpt_in_region (struct prmap *map,
- int (*child_func) (),
- void *data)
-{
- procinfo *pi = (procinfo *) data;
-
- /* We know the symbol we're looking for is in a text region, so
- only look for it if the region is a text one. */
- if (map->pr_mflags & MA_EXEC)
- return solib_mappings_callback (map, insert_dbx_link_bpt_in_file, pi);
-
- return 0;
-}
-
-/* Search all memory regions for a symbol named __dbx_link. If found,
- insert a breakpoint at its location, and return nonzero. Return zero
- otherwise. */
-
-static int
-insert_dbx_link_breakpoint (procinfo *pi)
-{
- return iterate_over_mappings (pi, NULL, pi, insert_dbx_link_bpt_in_region);
-}
-
/*
* Function: mappingflags
*