Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Duda <deo@logos-m.ru>2001-08-30 20:47:51 +0400
committerEgor Duda <deo@logos-m.ru>2001-08-30 20:47:51 +0400
commit33bc82476eb92308590d03407cb1597eca8b0079 (patch)
treef81ec8e1f0162af8b5c869e1319a1b2dfafc1008 /winsup/utils/dumper.cc
parent4208d592f30bccc25bfd46f329c6d21c8d4ae5e1 (diff)
* dumper.h: Update copyright notice.
* dumper.cc: Ditto. * dumper.cc: (dumper::print_core_section_list): New function. * dumper.h: (dumper::print_core_section_list): Declare it. * dumper.cc (print_section_name): New function. (dumper::collect_process_information): Augment debugging output. Stop debugee processing if it posts double exception. (usage): Fix typo in option name.
Diffstat (limited to 'winsup/utils/dumper.cc')
-rw-r--r--winsup/utils/dumper.cc42
1 files changed, 37 insertions, 5 deletions
diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc
index 9f8257b98..dfa0a7df5 100644
--- a/winsup/utils/dumper.cc
+++ b/winsup/utils/dumper.cc
@@ -1,6 +1,6 @@
/* dumper.cc
- Copyright 1999 Cygnus Solutions.
+ Copyright 1999,2001 Red Hat Inc.
Written by Egor Duda <deo@logos-m.ru>
@@ -114,6 +114,20 @@ dumper::sane ()
return 1;
}
+void
+print_section_name (bfd* abfd, asection* sect, PTR obj)
+{
+ deb_printf ( " %s", bfd_get_section_name (abfd, sect));
+}
+
+void
+dumper::print_core_section_list ()
+{
+ deb_printf ("current sections:");
+ bfd_map_over_sections (core_bfd, &print_section_name, NULL);
+ deb_printf ("\n");
+}
+
process_entity *
dumper::add_process_entity_to_list (process_entity_type type)
{
@@ -476,6 +490,8 @@ out:
int
dumper::collect_process_information ()
{
+ int exception_level = 0;
+
if (!sane ())
return 0;
@@ -496,6 +512,8 @@ dumper::collect_process_information ()
if (!WaitForDebugEvent (&current_event, 20000))
return 0;
+ deb_printf ("got debug event %d\n", current_event.dwDebugEventCode);
+
switch (current_event.dwDebugEventCode)
{
case CREATE_THREAD_DEBUG_EVENT:
@@ -535,6 +553,12 @@ dumper::collect_process_information ()
case EXCEPTION_DEBUG_EVENT:
+ exception_level++;
+ if (exception_level == 2)
+ break;
+ else if (exception_level > 2)
+ return 0;
+
collect_memory_sections ();
/* got all info. time to dump */
@@ -670,14 +694,22 @@ dumper::prepare_core_dump ()
deb_printf ("creating section (type%u) %s(%u), flags=%08x\n",
p->type, sect_name, sect_size, sect_flags);
+ bfd_set_error (bfd_error_no_error);
char *buf = strdup (sect_name);
new_section = bfd_make_section (core_bfd, buf);
+ if (new_section == NULL)
+ {
+ if (bfd_get_error () == bfd_error_no_error)
+ fprintf (stderr, "error creating new section (%s), section already exists.\n", buf);
+ else
+ bfd_perror ("creating section");
+ goto failed;
+ }
- if (new_section == NULL ||
- !bfd_set_section_flags (core_bfd, new_section, sect_flags) ||
+ if (!bfd_set_section_flags (core_bfd, new_section, sect_flags) ||
!bfd_set_section_size (core_bfd, new_section, sect_size))
{
- bfd_perror ("creating section");
+ bfd_perror ("setting section attributes");
goto failed;
};
@@ -736,7 +768,7 @@ dumper::write_core_dump ()
static void
usage ()
{
- fprintf (stderr, "Usage: dumper [-v] [-c filename] pid\n");
+ fprintf (stderr, "Usage: dumper [-d] [-c filename] pid\n");
fprintf (stderr, "-c filename -- dump core to filename.core\n");
fprintf (stderr, "-d -- print some debugging info while dumping\n");
fprintf (stderr, "pid -- win32-pid of process to dump\n");