From 1750a5ef21ab77772e1aa396d9483afb8177fc8c Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Thu, 4 Jan 1996 19:07:28 +0000 Subject: [PATCH] * mdebugread.c (mylookup_symbol): enum namespace becomes enum_namespace type. * symfile.c (add_psymbol_to_list) (add_psymbol_addr_to_list): Ditto. * symtab.c (lookup_partial_symbol): Ditto. (lookup_symbol): Ditto. (lookup_block_symbol): Ditto. * win32-nat.c (handle_load_dll): Use incoming dll base. (child_wait): Catch DLL load errors. (create_child_inferior): Translated between paths correctly. --- gdb/ChangeLog | 13 +++++++++++ gdb/mdebugread.c | 4 ++-- gdb/symfile.c | 9 ++++---- gdb/symtab.c | 10 ++++---- gdb/win32-nat.c | 60 ++++++++++++++++++++++++++++++++++++++---------- 5 files changed, 73 insertions(+), 23 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bb861784f1..97b776977a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +Thu Jan 4 11:00:01 1996 steve chamberlain + + * mdebugread.c (mylookup_symbol): enum namespace becomes + enum_namespace type. + * symfile.c (add_psymbol_to_list) + (add_psymbol_addr_to_list): Ditto. + * symtab.c (lookup_partial_symbol): Ditto. + (lookup_symbol): Ditto. + (lookup_block_symbol): Ditto. + * win32-nat.c (handle_load_dll): Use incoming dll base. + (child_wait): Catch DLL load errors. + (create_child_inferior): Translated between paths correctly. + Wed Jan 3 23:13:53 1996 Fred Fish * i386v4-nat.c (supply_gregset, fill_gregset): Subtract NUM_FREGS diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 0fa3c3d456..1c88f5110f 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -346,7 +346,7 @@ static struct type * parse_type PARAMS ((int, union aux_ext *, unsigned int, int *, int, char *)); static struct symbol * -mylookup_symbol PARAMS ((char *, struct block *, enum namespace, +mylookup_symbol PARAMS ((char *, struct block *, namespace_enum, enum address_class)); static struct block * @@ -3731,7 +3731,7 @@ static struct symbol * mylookup_symbol (name, block, namespace, class) char *name; register struct block *block; - enum namespace namespace; + namespace_enum namespace; enum address_class class; { register int bot, top, inc; diff --git a/gdb/symfile.c b/gdb/symfile.c index e0848cc067..dd10f5fddd 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -858,8 +858,9 @@ find_sym_fns (objfile) enum bfd_flavour our_flavour = bfd_get_flavour (objfile -> obfd); char *our_target = bfd_get_target (objfile -> obfd); - /* Special kludge for RS/6000. See xcoffread.c. */ - if (STREQ (our_target, "aixcoff-rs6000")) + /* Special kludge for RS/6000 and PowerMac. See xcoffread.c. */ + if (STREQ (our_target, "aixcoff-rs6000") || + STREQ (our_target, "xcoff-powermac")) our_flavour = (enum bfd_flavour)-1; /* Special kludge for apollo. See dstread.c. */ @@ -1626,7 +1627,7 @@ add_psymbol_to_list (name, namelength, namespace, class, list, val, language, objfile) char *name; int namelength; - enum namespace namespace; + namespace_enum namespace; enum address_class class; struct psymbol_allocation_list *list; long val; @@ -1662,7 +1663,7 @@ add_psymbol_addr_to_list (name, namelength, namespace, class, list, val, language, objfile) char *name; int namelength; - enum namespace namespace; + namespace_enum namespace; enum address_class class; struct psymbol_allocation_list *list; CORE_ADDR val; diff --git a/gdb/symtab.c b/gdb/symtab.c index 2b4037d9d2..302f0cf3a1 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "language.h" #include "demangle.h" -#include +#include "obstack.h" #include #include @@ -84,7 +84,7 @@ static int find_line_common PARAMS ((struct linetable *, int, int *)); static struct partial_symbol * lookup_partial_symbol PARAMS ((struct partial_symtab *, const char *, - int, enum namespace)); + int, namespace_enum)); static struct symtab * lookup_symtab_1 PARAMS ((char *)); @@ -476,7 +476,7 @@ struct symbol * lookup_symbol (name, block, namespace, is_a_field_of_this, symtab) const char *name; register const struct block *block; - const enum namespace namespace; + const namespace_enum namespace; int *is_a_field_of_this; struct symtab **symtab; { @@ -701,7 +701,7 @@ lookup_partial_symbol (pst, name, global, namespace) struct partial_symtab *pst; const char *name; int global; - enum namespace namespace; + namespace_enum namespace; { struct partial_symbol *start, *psym; struct partial_symbol *top, *bottom, *center; @@ -813,7 +813,7 @@ struct symbol * lookup_block_symbol (block, name, namespace) register const struct block *block; const char *name; - const enum namespace namespace; + const namespace_enum namespace; { register int bot, top, inc; register struct symbol *sym; diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 68c2649663..e295a663c9 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -36,7 +36,7 @@ #include "gdb_string.h" #include "thread.h" #include "gdbcmd.h" - +#include #define CHECK(x) check (x, __FILE__,__LINE__) #define DEBUG(x) if (remote_debug) printf x @@ -174,9 +174,10 @@ child_store_inferior_registers (int r) of error; store status through argument pointer OURSTATUS. */ -static void -handle_load_dll (DEBUG_EVENT * event) +static int +handle_load_dll (char *eventp) { + DEBUG_EVENT * event = (DEBUG_EVENT *)eventp; DWORD dll_name_ptr; DWORD done; @@ -236,13 +237,23 @@ handle_load_dll (DEBUG_EVENT * event) context.ContextFlags = CONTEXT_FULL; GetThreadContext (current_thread, &context); - symbol_file_add (dll_name, 0, (int) event->u.LoadDll.lpBaseOfDll, 0, 0, 0); + /* The symbols in a dll are offset by 0x1000, which is the + the offset from 0 of the first byte in an image - because + of the file header and the section alignment. + + FIXME: Is this the real reason that we need the 0x1000 ? */ + + + symbol_file_add (dll_name, 0, + (int) event->u.LoadDll.lpBaseOfDll + 0x1000, 0, 0, 0); /* We strip off the path of the dll for tidiness. */ if (strrchr (dll_name, '\\')) dll_name = strrchr (dll_name, '\\') + 1; + printf_unfiltered ("%x:%s\n", event->u.LoadDll.lpBaseOfDll, dll_name); } + return 1; } @@ -315,7 +326,11 @@ child_wait (int pid, struct target_waitstatus *ourstatus) break; case LOAD_DLL_DEBUG_EVENT: - handle_load_dll (&event); + catch_errors (handle_load_dll, + (char*) &event, + "\n[failed reading symbols from DLL]\n", + RETURN_MASK_ALL); + registers_changed(); /* mark all regs invalid */ break; case EXCEPTION_DEBUG_EVENT: handle_exception (&event, ourstatus); @@ -429,7 +444,12 @@ child_create_inferior (exec_file, allargs, env) char *allargs; char **env; { - char *real_path; + char real_path[MAXPATHLEN]; + char *winenv; + char *temp; + int envlen; + int i; + STARTUPINFO si; PROCESS_INFORMATION pi; struct target_waitstatus dummy; @@ -445,9 +465,7 @@ child_create_inferior (exec_file, allargs, env) memset (&si, 0, sizeof (si)); si.cb = sizeof (si); - /* A realpath is always the same size, or a bit shorter than a nice path. */ - real_path = alloca (strlen (exec_file) + 1); - path_to_real_path (exec_file, real_path); + unix_path_to_dos_path (exec_file, real_path); flags = DEBUG_ONLY_THIS_PROCESS | DEBUG_PROCESS; @@ -463,13 +481,31 @@ child_create_inferior (exec_file, allargs, env) strcat (args, " "); strcat (args, allargs); - ret = CreateProcess (real_path, - args, + + /* get total size for env strings */ + for (envlen = 0, i = 0; env[i] && *env[i]; i++) + envlen += strlen(env[i]) + 1; + + winenv = alloca(envlen + 1); /* allocate new buffer */ + + /* copy env strings into new buffer */ + for (temp = winenv, i = 0; env[i] && *env[i]; i++) + { + strcpy(temp, env[i]); + temp += strlen(temp) + 1; + } + *temp = 0; /* final nil string to terminate new env */ + + strcat (real_path, " "); + strcat (real_path, args); + + ret = CreateProcess (0, + real_path, NULL, /* Security */ NULL, /* thread */ TRUE, /* inherit handles */ flags, /* start flags */ - env, + winenv, NULL, /* current directory */ &si, &pi);