mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 02:24:46 +08:00
* win32-nat.c (psapi_get_dll_name): Fix a compiler warning.
(struct so_stuff): Add end_addr field. (register_loaded_dll): Calculate and store end address of loaded dll. (solib_address): New function. (child_solib_loaded_library_pathname): Pass carefully constructed section info to safe_symbol_file_add rather than ignoring it. (get_child_debug_event): Call re_enable_breakpoints_in_shlibs when a DLL is loaded. (do_initial_child_stuff): Call disable_breakpoints_in_shlibs. (child_create_inferior): Fix a compiler warning. * config/i386/tm-cygwin.h (PC_SOLIB): Define new macro. (solib_address): Declare new function.
This commit is contained in:
parent
b6d3ce7015
commit
5633f84268
@ -1,3 +1,18 @@
|
||||
2002-11-22 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* win32-nat.c (psapi_get_dll_name): Fix a compiler warning.
|
||||
(struct so_stuff): Add end_addr field.
|
||||
(register_loaded_dll): Calculate and store end address of loaded dll.
|
||||
(solib_address): New function.
|
||||
(child_solib_loaded_library_pathname): Pass carefully constructed
|
||||
section info to safe_symbol_file_add rather than ignoring it.
|
||||
(get_child_debug_event): Call re_enable_breakpoints_in_shlibs when a
|
||||
DLL is loaded.
|
||||
(do_initial_child_stuff): Call disable_breakpoints_in_shlibs.
|
||||
(child_create_inferior): Fix a compiler warning.
|
||||
* config/i386/tm-cygwin.h (PC_SOLIB): Define new macro.
|
||||
(solib_address): Declare new function.
|
||||
|
||||
2002-11-22 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* m68k-tdep.c (m68k_register_virtual_type): Return int for SR, FPC
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Macro definitions for i386 running under the win32 API Unix.
|
||||
Copyright 1995, 1996, 1997, 1998, 1999, 2000
|
||||
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
#define ATTACH_NO_WAIT
|
||||
#define SOLIB_ADD(filename, from_tty, targ, readsyms) child_solib_add(filename, from_tty, targ, readsyms)
|
||||
#define PC_SOLIB(addr) solib_address (addr)
|
||||
#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) child_solib_loaded_library_pathname(pid)
|
||||
#define CLEAR_SOLIB child_clear_solibs
|
||||
#define ADD_SHARED_SYMBOL_FILES dll_symbol_command
|
||||
@ -37,6 +38,9 @@
|
||||
struct target_ops;
|
||||
char *cygwin_pid_to_str (ptid_t ptid);
|
||||
void child_solib_add (char *, int, struct target_ops *, int);
|
||||
char *solib_address (CORE_ADDR);
|
||||
char *child_solib_loaded_library_pathname(int);
|
||||
void child_clear_solibs (void);
|
||||
void dll_symbol_command (char *, int);
|
||||
|
||||
#define LINKER_SYMBOLS_HAVE_WIN32_STDCALL_ARG_SIZES (1)
|
||||
|
@ -473,7 +473,7 @@ psapi_get_dll_name (DWORD BaseAddress, char *dll_name_ret)
|
||||
dll_name_ret,
|
||||
MAX_PATH);
|
||||
if (len == 0)
|
||||
error ("Error getting dll name: %u\n", GetLastError ());
|
||||
error ("Error getting dll name: %u\n", (unsigned) GetLastError ());
|
||||
|
||||
if ((DWORD) (mi.lpBaseOfDll) == BaseAddress)
|
||||
return 1;
|
||||
@ -502,6 +502,7 @@ struct so_stuff
|
||||
{
|
||||
struct so_stuff *next;
|
||||
DWORD load_addr;
|
||||
DWORD end_addr;
|
||||
int loaded;
|
||||
struct objfile *objfile;
|
||||
char name[1];
|
||||
@ -578,6 +579,7 @@ register_loaded_dll (const char *name, DWORD load_addr)
|
||||
char *p;
|
||||
WIN32_FIND_DATA w32_fd;
|
||||
HANDLE h = FindFirstFile(name, &w32_fd);
|
||||
MEMORY_BASIC_INFORMATION m;
|
||||
size_t len;
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
@ -601,6 +603,12 @@ register_loaded_dll (const char *name, DWORD load_addr)
|
||||
so = (struct so_stuff *) xmalloc (sizeof (struct so_stuff) + strlen (ppath) + 8 + 1);
|
||||
so->loaded = 0;
|
||||
so->load_addr = load_addr;
|
||||
if (!VirtualQueryEx (current_process_handle, (void *) load_addr, &m,
|
||||
sizeof (m)))
|
||||
so->end_addr = (DWORD) m.AllocationBase + m.RegionSize;
|
||||
else
|
||||
so->end_addr = load_addr + 0x2000; /* completely arbitrary */
|
||||
|
||||
so->next = NULL;
|
||||
so->objfile = NULL;
|
||||
strcpy (so->name, ppath);
|
||||
@ -708,6 +716,16 @@ handle_unload_dll (void *dummy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
solib_address (CORE_ADDR address)
|
||||
{
|
||||
struct so_stuff *so;
|
||||
for (so = &solib_start; so->next != NULL; so = so->next)
|
||||
if (address >= so->load_addr && address <= so->end_addr)
|
||||
return so->name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return name of last loaded DLL. */
|
||||
char *
|
||||
child_solib_loaded_library_pathname (int pid)
|
||||
@ -749,7 +767,7 @@ solib_symbols_add (char *name, int from_tty, CORE_ADDR load_addr)
|
||||
memset (§ion_addrs, 0, sizeof (section_addrs));
|
||||
section_addrs.other[0].name = ".text";
|
||||
section_addrs.other[0].addr = load_addr;
|
||||
return safe_symbol_file_add (name, from_tty, NULL, 0, OBJF_SHARED);
|
||||
return safe_symbol_file_add (name, from_tty, §ion_addrs, 0, OBJF_SHARED);
|
||||
}
|
||||
|
||||
/* Load DLL symbol info. */
|
||||
@ -1198,6 +1216,7 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
||||
ourstatus->kind = TARGET_WAITKIND_LOADED;
|
||||
ourstatus->value.integer = 0;
|
||||
retval = main_thread_id;
|
||||
re_enable_breakpoints_in_shlibs ();
|
||||
break;
|
||||
|
||||
case UNLOAD_DLL_DEBUG_EVENT:
|
||||
@ -1305,6 +1324,7 @@ do_initial_child_stuff (DWORD pid)
|
||||
memset (¤t_event, 0, sizeof (current_event));
|
||||
push_target (&child_ops);
|
||||
child_init_thread_list ();
|
||||
disable_breakpoints_in_shlibs (1);
|
||||
child_clear_solibs ();
|
||||
clear_proceed_status ();
|
||||
init_wait_for_inferior ();
|
||||
@ -1618,7 +1638,7 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ());
|
||||
error ("Error creating process %s, (error %d)\n", exec_file, (unsigned) GetLastError ());
|
||||
|
||||
CloseHandle (pi.hThread);
|
||||
CloseHandle (pi.hProcess);
|
||||
|
@ -473,7 +473,7 @@ psapi_get_dll_name (DWORD BaseAddress, char *dll_name_ret)
|
||||
dll_name_ret,
|
||||
MAX_PATH);
|
||||
if (len == 0)
|
||||
error ("Error getting dll name: %u\n", GetLastError ());
|
||||
error ("Error getting dll name: %u\n", (unsigned) GetLastError ());
|
||||
|
||||
if ((DWORD) (mi.lpBaseOfDll) == BaseAddress)
|
||||
return 1;
|
||||
@ -502,6 +502,7 @@ struct so_stuff
|
||||
{
|
||||
struct so_stuff *next;
|
||||
DWORD load_addr;
|
||||
DWORD end_addr;
|
||||
int loaded;
|
||||
struct objfile *objfile;
|
||||
char name[1];
|
||||
@ -578,6 +579,7 @@ register_loaded_dll (const char *name, DWORD load_addr)
|
||||
char *p;
|
||||
WIN32_FIND_DATA w32_fd;
|
||||
HANDLE h = FindFirstFile(name, &w32_fd);
|
||||
MEMORY_BASIC_INFORMATION m;
|
||||
size_t len;
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
@ -601,6 +603,12 @@ register_loaded_dll (const char *name, DWORD load_addr)
|
||||
so = (struct so_stuff *) xmalloc (sizeof (struct so_stuff) + strlen (ppath) + 8 + 1);
|
||||
so->loaded = 0;
|
||||
so->load_addr = load_addr;
|
||||
if (!VirtualQueryEx (current_process_handle, (void *) load_addr, &m,
|
||||
sizeof (m)))
|
||||
so->end_addr = (DWORD) m.AllocationBase + m.RegionSize;
|
||||
else
|
||||
so->end_addr = load_addr + 0x2000; /* completely arbitrary */
|
||||
|
||||
so->next = NULL;
|
||||
so->objfile = NULL;
|
||||
strcpy (so->name, ppath);
|
||||
@ -708,6 +716,16 @@ handle_unload_dll (void *dummy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
solib_address (CORE_ADDR address)
|
||||
{
|
||||
struct so_stuff *so;
|
||||
for (so = &solib_start; so->next != NULL; so = so->next)
|
||||
if (address >= so->load_addr && address <= so->end_addr)
|
||||
return so->name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return name of last loaded DLL. */
|
||||
char *
|
||||
child_solib_loaded_library_pathname (int pid)
|
||||
@ -749,7 +767,7 @@ solib_symbols_add (char *name, int from_tty, CORE_ADDR load_addr)
|
||||
memset (§ion_addrs, 0, sizeof (section_addrs));
|
||||
section_addrs.other[0].name = ".text";
|
||||
section_addrs.other[0].addr = load_addr;
|
||||
return safe_symbol_file_add (name, from_tty, NULL, 0, OBJF_SHARED);
|
||||
return safe_symbol_file_add (name, from_tty, §ion_addrs, 0, OBJF_SHARED);
|
||||
}
|
||||
|
||||
/* Load DLL symbol info. */
|
||||
@ -1198,6 +1216,7 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
||||
ourstatus->kind = TARGET_WAITKIND_LOADED;
|
||||
ourstatus->value.integer = 0;
|
||||
retval = main_thread_id;
|
||||
re_enable_breakpoints_in_shlibs ();
|
||||
break;
|
||||
|
||||
case UNLOAD_DLL_DEBUG_EVENT:
|
||||
@ -1305,6 +1324,7 @@ do_initial_child_stuff (DWORD pid)
|
||||
memset (¤t_event, 0, sizeof (current_event));
|
||||
push_target (&child_ops);
|
||||
child_init_thread_list ();
|
||||
disable_breakpoints_in_shlibs (1);
|
||||
child_clear_solibs ();
|
||||
clear_proceed_status ();
|
||||
init_wait_for_inferior ();
|
||||
@ -1618,7 +1638,7 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ());
|
||||
error ("Error creating process %s, (error %d)\n", exec_file, (unsigned) GetLastError ());
|
||||
|
||||
CloseHandle (pi.hThread);
|
||||
CloseHandle (pi.hProcess);
|
||||
|
Loading…
Reference in New Issue
Block a user