Re: syms_from_objfile() warnings and win32-nat.c IO redirection (Was: suppress annoying warnings about cygwin1.dbg)

Pedro Alves
2007-11-09T01:35:36Z

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

Pedro Alves wrote:
>
> Is there anything else preventing us from removing the
> stderr -> null redirection from win32-nat.c ?
>

Like so ?

--
Cheers,
Pedro Alves

[-- Attachment #2: remove_redirect_null.diff --]
[-- Type: text/x-diff, Size: 2938 bytes --]

2007-11-08 Pedro Alves <pedro_alves@portugalmail.pt>

* win32-nat.c (safe_symbol_file_add_args,
safe_symbol_file_add_stub, safe_symbol_file_add_cleanup)
(safe_symbol_file_add): Remove.
(dll_symbol_command): Call symbol_file_add directly.

---
gdb/win32-nat.c | 70 --------------------------------------------------------
1 file changed, 1 insertion(+), 69 deletions(-)

Index: src/gdb/win32-nat.c
===================================================================
--- src.orig/gdb/win32-nat.c 2007-11-08 23:12:36.000000000 +0000
+++ src/gdb/win32-nat.c 2007-11-08 23:12:40.000000000 +0000
@@ -527,19 +527,6 @@ failed:
return 0;
}

-/* Encapsulate the information required in a call to
- symbol_file_add_args */
-struct safe_symbol_file_add_args
-{
- char *name;
- int from_tty;
- struct section_addr_info *addrs;
- int mainline;
- int flags;
- struct ui_file *err, *out;
- struct objfile *ret;
-};
-
/* Maintain a linked list of "so" information. */
struct lm_info
{
@@ -548,61 +535,6 @@ struct lm_info

static struct so_list solib_start, *solib_end;

-/* Call symbol_file_add with stderr redirected. We don't care if there
- are errors. */
-static int
-safe_symbol_file_add_stub (void *argv)
-{
-#define p ((struct safe_symbol_file_add_args *) argv)
- struct so_list *so = &solib_start;
-
- p->ret = symbol_file_add (p->name, p->from_tty, p->addrs, p->mainline, p->flags);
- return !!p->ret;
-#undef p
-}
-
-/* Restore gdb's stderr after calling symbol_file_add */
-static void
-safe_symbol_file_add_cleanup (void *p)
-{
-#define sp ((struct safe_symbol_file_add_args *)p)
- gdb_flush (gdb_stderr);
- gdb_flush (gdb_stdout);
- ui_file_delete (gdb_stderr);
- ui_file_delete (gdb_stdout);
- gdb_stderr = sp->err;
- gdb_stdout = sp->out;
-#undef sp
-}
-
-/* symbol_file_add wrapper that prevents errors from being displayed. */
-static struct objfile *
-safe_symbol_file_add (char *name, int from_tty,
- struct section_addr_info *addrs,
- int mainline, int flags)
-{
- struct safe_symbol_file_add_args p;
- struct cleanup *cleanup;
-
- cleanup = make_cleanup (safe_symbol_file_add_cleanup, &p);
-
- p.err = gdb_stderr;
- p.out = gdb_stdout;
- gdb_flush (gdb_stderr);
- gdb_flush (gdb_stdout);
- gdb_stderr = ui_file_new ();
- gdb_stdout = ui_file_new ();
- p.name = name;
- p.from_tty = from_tty;
- p.addrs = addrs;
- p.mainline = mainline;
- p.flags = flags;
- catch_errors (safe_symbol_file_add_stub, &p, "", RETURN_MASK_ERROR);
-
- do_cleanups (cleanup);
- return p.ret;
-}
-
static struct so_list *
win32_make_so (const char *name, DWORD load_addr)
{
@@ -806,7 +738,7 @@ dll_symbol_command (char *args, int from
args = newargs;
}

- safe_symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED);
+ symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED);
}

/* Handle DEBUG_STRING output from child process.