mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-28 06:20:30 +00:00
* win32-nat.c (get_child_debug_event): Keep main thread id around even after
thread exits since Windows insists on continuing to report events against it.
This commit is contained in:
parent
ffeaf0e8c6
commit
87a45c9606
@ -1,3 +1,9 @@
|
|||||||
|
2003-12-25 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* win32-nat.c (get_child_debug_event): Keep main thread id around even
|
||||||
|
after thread exits since Windows insists on continuing to report events
|
||||||
|
against it.
|
||||||
|
|
||||||
2003-12-22 Mark Kettenis <kettenis@gnu.org>
|
2003-12-22 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
* dwarf2-frame.c (dwarf2_frame_cache): Don't skip the return
|
* dwarf2-frame.c (dwarf2_frame_cache): Don't skip the return
|
||||||
|
124
gdb/win32-nat.c
124
gdb/win32-nat.c
@ -76,8 +76,8 @@ enum
|
|||||||
| CONTEXT_EXTENDED_REGISTERS
|
| CONTEXT_EXTENDED_REGISTERS
|
||||||
|
|
||||||
static unsigned dr[8];
|
static unsigned dr[8];
|
||||||
static int debug_registers_changed = 0;
|
static int debug_registers_changed;
|
||||||
static int debug_registers_used = 0;
|
static int debug_registers_used;
|
||||||
|
|
||||||
/* The string sent by cygwin when it processes a signal.
|
/* The string sent by cygwin when it processes a signal.
|
||||||
FIXME: This should be in a cygwin include file. */
|
FIXME: This should be in a cygwin include file. */
|
||||||
@ -1205,7 +1205,7 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
|||||||
{
|
{
|
||||||
BOOL debug_event;
|
BOOL debug_event;
|
||||||
DWORD continue_status, event_code;
|
DWORD continue_status, event_code;
|
||||||
thread_info *th = NULL;
|
thread_info *th;
|
||||||
static thread_info dummy_thread_info;
|
static thread_info dummy_thread_info;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
@ -1219,6 +1219,7 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
|||||||
|
|
||||||
event_code = current_event.dwDebugEventCode;
|
event_code = current_event.dwDebugEventCode;
|
||||||
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
|
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
|
||||||
|
th = NULL;
|
||||||
|
|
||||||
switch (event_code)
|
switch (event_code)
|
||||||
{
|
{
|
||||||
@ -1246,8 +1247,11 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
|||||||
"EXIT_THREAD_DEBUG_EVENT"));
|
"EXIT_THREAD_DEBUG_EVENT"));
|
||||||
if (saw_create != 1)
|
if (saw_create != 1)
|
||||||
break;
|
break;
|
||||||
child_delete_thread (current_event.dwThreadId);
|
if (current_event.dwThreadId != main_thread_id)
|
||||||
th = &dummy_thread_info;
|
{
|
||||||
|
child_delete_thread (current_event.dwThreadId);
|
||||||
|
th = &dummy_thread_info;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CREATE_PROCESS_DEBUG_EVENT:
|
case CREATE_PROCESS_DEBUG_EVENT:
|
||||||
@ -1263,12 +1267,10 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
|
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
|
||||||
|
if (main_thread_id)
|
||||||
|
child_delete_thread (main_thread_id);
|
||||||
main_thread_id = current_event.dwThreadId;
|
main_thread_id = current_event.dwThreadId;
|
||||||
/* Add the main thread */
|
/* Add the main thread */
|
||||||
#if 0
|
|
||||||
th = child_add_thread (current_event.dwProcessId,
|
|
||||||
current_event.u.CreateProcessInfo.hProcess);
|
|
||||||
#endif
|
|
||||||
th = child_add_thread (main_thread_id,
|
th = child_add_thread (main_thread_id,
|
||||||
current_event.u.CreateProcessInfo.hThread);
|
current_event.u.CreateProcessInfo.hThread);
|
||||||
retval = ourstatus->value.related_pid = current_event.dwThreadId;
|
retval = ourstatus->value.related_pid = current_event.dwThreadId;
|
||||||
@ -2199,65 +2201,65 @@ core_dll_symbols_add (char *dll_name, DWORD base_addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
register_loaded_dll (dll_name, base_addr + 0x1000);
|
register_loaded_dll (dll_name, base_addr + 0x1000);
|
||||||
solib_symbols_add (dll_name, 0, (CORE_ADDR) base_addr + 0x1000);
|
solib_symbols_add (dll_name, 0, (CORE_ADDR) base_addr + 0x1000);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
struct target_ops *target;
|
struct target_ops *target;
|
||||||
bfd_vma addr;
|
bfd_vma addr;
|
||||||
} map_code_section_args;
|
} map_code_section_args;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
map_single_dll_code_section (bfd * abfd, asection * sect, void *obj)
|
map_single_dll_code_section (bfd * abfd, asection * sect, void *obj)
|
||||||
{
|
{
|
||||||
int old;
|
int old;
|
||||||
int update_coreops;
|
int update_coreops;
|
||||||
struct section_table *new_target_sect_ptr;
|
struct section_table *new_target_sect_ptr;
|
||||||
|
|
||||||
map_code_section_args *args = (map_code_section_args *) obj;
|
map_code_section_args *args = (map_code_section_args *) obj;
|
||||||
struct target_ops *target = args->target;
|
struct target_ops *target = args->target;
|
||||||
if (sect->flags & SEC_CODE)
|
if (sect->flags & SEC_CODE)
|
||||||
{
|
{
|
||||||
update_coreops = core_ops.to_sections == target->to_sections;
|
update_coreops = core_ops.to_sections == target->to_sections;
|
||||||
|
|
||||||
if (target->to_sections)
|
if (target->to_sections)
|
||||||
{
|
{
|
||||||
old = target->to_sections_end - target->to_sections;
|
old = target->to_sections_end - target->to_sections;
|
||||||
target->to_sections = (struct section_table *)
|
target->to_sections = (struct section_table *)
|
||||||
xrealloc ((char *) target->to_sections,
|
xrealloc ((char *) target->to_sections,
|
||||||
(sizeof (struct section_table)) * (1 + old));
|
(sizeof (struct section_table)) * (1 + old));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
old = 0;
|
old = 0;
|
||||||
target->to_sections = (struct section_table *)
|
target->to_sections = (struct section_table *)
|
||||||
xmalloc ((sizeof (struct section_table)));
|
xmalloc ((sizeof (struct section_table)));
|
||||||
}
|
}
|
||||||
target->to_sections_end = target->to_sections + (1 + old);
|
target->to_sections_end = target->to_sections + (1 + old);
|
||||||
|
|
||||||
/* Update the to_sections field in the core_ops structure
|
/* Update the to_sections field in the core_ops structure
|
||||||
if needed. */
|
if needed. */
|
||||||
if (update_coreops)
|
if (update_coreops)
|
||||||
{
|
{
|
||||||
core_ops.to_sections = target->to_sections;
|
core_ops.to_sections = target->to_sections;
|
||||||
core_ops.to_sections_end = target->to_sections_end;
|
core_ops.to_sections_end = target->to_sections_end;
|
||||||
}
|
}
|
||||||
new_target_sect_ptr = target->to_sections + old;
|
new_target_sect_ptr = target->to_sections + old;
|
||||||
new_target_sect_ptr->addr = args->addr + bfd_section_vma (abfd, sect);
|
new_target_sect_ptr->addr = args->addr + bfd_section_vma (abfd, sect);
|
||||||
new_target_sect_ptr->endaddr = args->addr + bfd_section_vma (abfd, sect) +
|
new_target_sect_ptr->endaddr = args->addr + bfd_section_vma (abfd, sect) +
|
||||||
bfd_section_size (abfd, sect);;
|
bfd_section_size (abfd, sect);;
|
||||||
new_target_sect_ptr->the_bfd_section = sect;
|
new_target_sect_ptr->the_bfd_section = sect;
|
||||||
new_target_sect_ptr->bfd = abfd;
|
new_target_sect_ptr->bfd = abfd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dll_code_sections_add (const char *dll_name, int base_addr, struct target_ops *target)
|
dll_code_sections_add (const char *dll_name, int base_addr, struct target_ops *target)
|
||||||
{
|
{
|
||||||
bfd *dll_bfd;
|
bfd *dll_bfd;
|
||||||
map_code_section_args map_args;
|
map_code_section_args map_args;
|
||||||
|
@ -76,8 +76,8 @@ enum
|
|||||||
| CONTEXT_EXTENDED_REGISTERS
|
| CONTEXT_EXTENDED_REGISTERS
|
||||||
|
|
||||||
static unsigned dr[8];
|
static unsigned dr[8];
|
||||||
static int debug_registers_changed = 0;
|
static int debug_registers_changed;
|
||||||
static int debug_registers_used = 0;
|
static int debug_registers_used;
|
||||||
|
|
||||||
/* The string sent by cygwin when it processes a signal.
|
/* The string sent by cygwin when it processes a signal.
|
||||||
FIXME: This should be in a cygwin include file. */
|
FIXME: This should be in a cygwin include file. */
|
||||||
@ -1205,7 +1205,7 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
|||||||
{
|
{
|
||||||
BOOL debug_event;
|
BOOL debug_event;
|
||||||
DWORD continue_status, event_code;
|
DWORD continue_status, event_code;
|
||||||
thread_info *th = NULL;
|
thread_info *th;
|
||||||
static thread_info dummy_thread_info;
|
static thread_info dummy_thread_info;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
@ -1219,6 +1219,7 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
|||||||
|
|
||||||
event_code = current_event.dwDebugEventCode;
|
event_code = current_event.dwDebugEventCode;
|
||||||
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
|
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
|
||||||
|
th = NULL;
|
||||||
|
|
||||||
switch (event_code)
|
switch (event_code)
|
||||||
{
|
{
|
||||||
@ -1246,8 +1247,11 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
|||||||
"EXIT_THREAD_DEBUG_EVENT"));
|
"EXIT_THREAD_DEBUG_EVENT"));
|
||||||
if (saw_create != 1)
|
if (saw_create != 1)
|
||||||
break;
|
break;
|
||||||
child_delete_thread (current_event.dwThreadId);
|
if (current_event.dwThreadId != main_thread_id)
|
||||||
th = &dummy_thread_info;
|
{
|
||||||
|
child_delete_thread (current_event.dwThreadId);
|
||||||
|
th = &dummy_thread_info;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CREATE_PROCESS_DEBUG_EVENT:
|
case CREATE_PROCESS_DEBUG_EVENT:
|
||||||
@ -1263,12 +1267,10 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
|
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
|
||||||
|
if (main_thread_id)
|
||||||
|
child_delete_thread (main_thread_id);
|
||||||
main_thread_id = current_event.dwThreadId;
|
main_thread_id = current_event.dwThreadId;
|
||||||
/* Add the main thread */
|
/* Add the main thread */
|
||||||
#if 0
|
|
||||||
th = child_add_thread (current_event.dwProcessId,
|
|
||||||
current_event.u.CreateProcessInfo.hProcess);
|
|
||||||
#endif
|
|
||||||
th = child_add_thread (main_thread_id,
|
th = child_add_thread (main_thread_id,
|
||||||
current_event.u.CreateProcessInfo.hThread);
|
current_event.u.CreateProcessInfo.hThread);
|
||||||
retval = ourstatus->value.related_pid = current_event.dwThreadId;
|
retval = ourstatus->value.related_pid = current_event.dwThreadId;
|
||||||
@ -2199,65 +2201,65 @@ core_dll_symbols_add (char *dll_name, DWORD base_addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
register_loaded_dll (dll_name, base_addr + 0x1000);
|
register_loaded_dll (dll_name, base_addr + 0x1000);
|
||||||
solib_symbols_add (dll_name, 0, (CORE_ADDR) base_addr + 0x1000);
|
solib_symbols_add (dll_name, 0, (CORE_ADDR) base_addr + 0x1000);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
struct target_ops *target;
|
struct target_ops *target;
|
||||||
bfd_vma addr;
|
bfd_vma addr;
|
||||||
} map_code_section_args;
|
} map_code_section_args;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
map_single_dll_code_section (bfd * abfd, asection * sect, void *obj)
|
map_single_dll_code_section (bfd * abfd, asection * sect, void *obj)
|
||||||
{
|
{
|
||||||
int old;
|
int old;
|
||||||
int update_coreops;
|
int update_coreops;
|
||||||
struct section_table *new_target_sect_ptr;
|
struct section_table *new_target_sect_ptr;
|
||||||
|
|
||||||
map_code_section_args *args = (map_code_section_args *) obj;
|
map_code_section_args *args = (map_code_section_args *) obj;
|
||||||
struct target_ops *target = args->target;
|
struct target_ops *target = args->target;
|
||||||
if (sect->flags & SEC_CODE)
|
if (sect->flags & SEC_CODE)
|
||||||
{
|
{
|
||||||
update_coreops = core_ops.to_sections == target->to_sections;
|
update_coreops = core_ops.to_sections == target->to_sections;
|
||||||
|
|
||||||
if (target->to_sections)
|
if (target->to_sections)
|
||||||
{
|
{
|
||||||
old = target->to_sections_end - target->to_sections;
|
old = target->to_sections_end - target->to_sections;
|
||||||
target->to_sections = (struct section_table *)
|
target->to_sections = (struct section_table *)
|
||||||
xrealloc ((char *) target->to_sections,
|
xrealloc ((char *) target->to_sections,
|
||||||
(sizeof (struct section_table)) * (1 + old));
|
(sizeof (struct section_table)) * (1 + old));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
old = 0;
|
old = 0;
|
||||||
target->to_sections = (struct section_table *)
|
target->to_sections = (struct section_table *)
|
||||||
xmalloc ((sizeof (struct section_table)));
|
xmalloc ((sizeof (struct section_table)));
|
||||||
}
|
}
|
||||||
target->to_sections_end = target->to_sections + (1 + old);
|
target->to_sections_end = target->to_sections + (1 + old);
|
||||||
|
|
||||||
/* Update the to_sections field in the core_ops structure
|
/* Update the to_sections field in the core_ops structure
|
||||||
if needed. */
|
if needed. */
|
||||||
if (update_coreops)
|
if (update_coreops)
|
||||||
{
|
{
|
||||||
core_ops.to_sections = target->to_sections;
|
core_ops.to_sections = target->to_sections;
|
||||||
core_ops.to_sections_end = target->to_sections_end;
|
core_ops.to_sections_end = target->to_sections_end;
|
||||||
}
|
}
|
||||||
new_target_sect_ptr = target->to_sections + old;
|
new_target_sect_ptr = target->to_sections + old;
|
||||||
new_target_sect_ptr->addr = args->addr + bfd_section_vma (abfd, sect);
|
new_target_sect_ptr->addr = args->addr + bfd_section_vma (abfd, sect);
|
||||||
new_target_sect_ptr->endaddr = args->addr + bfd_section_vma (abfd, sect) +
|
new_target_sect_ptr->endaddr = args->addr + bfd_section_vma (abfd, sect) +
|
||||||
bfd_section_size (abfd, sect);;
|
bfd_section_size (abfd, sect);;
|
||||||
new_target_sect_ptr->the_bfd_section = sect;
|
new_target_sect_ptr->the_bfd_section = sect;
|
||||||
new_target_sect_ptr->bfd = abfd;
|
new_target_sect_ptr->bfd = abfd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dll_code_sections_add (const char *dll_name, int base_addr, struct target_ops *target)
|
dll_code_sections_add (const char *dll_name, int base_addr, struct target_ops *target)
|
||||||
{
|
{
|
||||||
bfd *dll_bfd;
|
bfd *dll_bfd;
|
||||||
map_code_section_args map_args;
|
map_code_section_args map_args;
|
||||||
|
Loading…
Reference in New Issue
Block a user