Cygwin: utils: drop 32 bit considerations
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
f51e76da0a
commit
1fc3014728
|
@ -562,11 +562,7 @@ dumper::dump_module (asection * to, process_module * module)
|
||||||
strncpy (header.elf_note_header.name, "win32module", NOTE_NAME_SIZE);
|
strncpy (header.elf_note_header.name, "win32module", NOTE_NAME_SIZE);
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#ifdef __x86_64__
|
|
||||||
module_pstatus_ptr->data_type = NOTE_INFO_MODULE64;
|
module_pstatus_ptr->data_type = NOTE_INFO_MODULE64;
|
||||||
#else
|
|
||||||
module_pstatus_ptr->data_type = NOTE_INFO_MODULE;
|
|
||||||
#endif
|
|
||||||
module_pstatus_ptr->data.module_info.base_address = module->base_address;
|
module_pstatus_ptr->data.module_info.base_address = module->base_address;
|
||||||
module_pstatus_ptr->data.module_info.module_name_size = strlen (module->name) + 1;
|
module_pstatus_ptr->data.module_info.module_name_size = strlen (module->name) + 1;
|
||||||
strcpy (module_pstatus_ptr->data.module_info.module_name, module->name);
|
strcpy (module_pstatus_ptr->data.module_info.module_name, module->name);
|
||||||
|
@ -707,7 +703,7 @@ dumper::init_core_dump ()
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
const char *target = "elf64-x86-64";
|
const char *target = "elf64-x86-64";
|
||||||
#else
|
#else
|
||||||
const char *target = "elf32-i386";
|
#error unimplemented for this target
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
core_bfd = bfd_openw (file_name, target);
|
core_bfd = bfd_openw (file_name, target);
|
||||||
|
|
|
@ -625,12 +625,7 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse)
|
||||||
}
|
}
|
||||||
int base_off = 108;
|
int base_off = 108;
|
||||||
#else
|
#else
|
||||||
if (arch != IMAGE_FILE_MACHINE_I386)
|
#error unimplemented for this target
|
||||||
{
|
|
||||||
puts (verbose ? " (not x86 dll)" : "\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int base_off = 92;
|
|
||||||
#endif
|
#endif
|
||||||
int opthdr_ofs = pe_header_offset + 4 + 20;
|
int opthdr_ofs = pe_header_offset + 4 + 20;
|
||||||
unsigned short v[6];
|
unsigned short v[6];
|
||||||
|
@ -2019,7 +2014,7 @@ static const char base_url[] =
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
#define ARCH_STR "&arch=x86_64"
|
#define ARCH_STR "&arch=x86_64"
|
||||||
#else
|
#else
|
||||||
#define ARCH_STR "&arch=x86"
|
#error unimplemented for this target
|
||||||
#endif
|
#endif
|
||||||
static const char *ARCH_str = ARCH_STR;
|
static const char *ARCH_str = ARCH_STR;
|
||||||
|
|
||||||
|
|
|
@ -494,11 +494,7 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
char *s = strtok (buf, " ");
|
char *s = strtok (buf, " ");
|
||||||
|
|
||||||
#ifdef __x86_64__
|
|
||||||
unsigned long long n = strtoull (s, NULL, 16);
|
unsigned long long n = strtoull (s, NULL, 16);
|
||||||
#else
|
|
||||||
unsigned long n = strtoul (s, NULL, 16);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
s = strchr (s, '\0') + 1;
|
s = strchr (s, '\0') + 1;
|
||||||
|
|
||||||
|
@ -635,11 +631,7 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
|
||||||
if (include_hex)
|
if (include_hex)
|
||||||
{
|
{
|
||||||
s -= 8;
|
s -= 8;
|
||||||
#ifdef __x86_64__
|
|
||||||
sprintf (s, "%012llx", n);
|
sprintf (s, "%012llx", n);
|
||||||
#else
|
|
||||||
sprintf (s, "%08lx", n);
|
|
||||||
#endif
|
|
||||||
strchr (s, '\0')[0] = ' ';
|
strchr (s, '\0')[0] = ' ';
|
||||||
}
|
}
|
||||||
child->last_usecs = usecs;
|
child->last_usecs = usecs;
|
||||||
|
@ -791,13 +783,11 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid)
|
||||||
case STATUS_BREAKPOINT:
|
case STATUS_BREAKPOINT:
|
||||||
case 0x406d1388: /* SetThreadName exception. */
|
case 0x406d1388: /* SetThreadName exception. */
|
||||||
break;
|
break;
|
||||||
#ifdef __x86_64__
|
|
||||||
case STATUS_GCC_THROW:
|
case STATUS_GCC_THROW:
|
||||||
case STATUS_GCC_UNWIND:
|
case STATUS_GCC_UNWIND:
|
||||||
case STATUS_GCC_FORCED:
|
case STATUS_GCC_FORCED:
|
||||||
status = DBG_EXCEPTION_NOT_HANDLED;
|
status = DBG_EXCEPTION_NOT_HANDLED;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
status = DBG_EXCEPTION_NOT_HANDLED;
|
status = DBG_EXCEPTION_NOT_HANDLED;
|
||||||
if (ev.u.Exception.dwFirstChance)
|
if (ev.u.Exception.dwFirstChance)
|
||||||
|
|
|
@ -191,11 +191,10 @@ sample (CONTEXT *context, HANDLE h)
|
||||||
return 0ULL;
|
return 0ULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
//TODO this approach does not support 32-bit executables on 64-bit
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
return context->Rip;
|
return context->Rip;
|
||||||
#else
|
#else
|
||||||
return context->Eip;
|
#error unimplemented for this target
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,8 +494,6 @@ find_text_section (LPVOID base, HANDLE h)
|
||||||
read_child ((void *) &lfanew, sizeof (lfanew), &idh->e_lfanew, h);
|
read_child ((void *) &lfanew, sizeof (lfanew), &idh->e_lfanew, h);
|
||||||
ptr += lfanew;
|
ptr += lfanew;
|
||||||
|
|
||||||
/* Code handles 32- or 64-bit headers depending on compilation environment. */
|
|
||||||
/*TODO It doesn't yet handle 32-bit headers on 64-bit Cygwin or v/v. */
|
|
||||||
IMAGE_NT_HEADERS *inth = (IMAGE_NT_HEADERS *) ptr;
|
IMAGE_NT_HEADERS *inth = (IMAGE_NT_HEADERS *) ptr;
|
||||||
read_child ((void *) &ntsig, sizeof (ntsig), &inth->Signature, h);
|
read_child ((void *) &ntsig, sizeof (ntsig), &inth->Signature, h);
|
||||||
if (ntsig != IMAGE_NT_SIGNATURE)
|
if (ntsig != IMAGE_NT_SIGNATURE)
|
||||||
|
@ -507,7 +504,7 @@ find_text_section (LPVOID base, HANDLE h)
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
if (machine != IMAGE_FILE_MACHINE_AMD64)
|
if (machine != IMAGE_FILE_MACHINE_AMD64)
|
||||||
#else
|
#else
|
||||||
if (machine != IMAGE_FILE_MACHINE_I386)
|
#error unimplemented for this target
|
||||||
#endif
|
#endif
|
||||||
error (0, "target program was built for different machine architecture\n");
|
error (0, "target program was built for different machine architecture\n");
|
||||||
|
|
||||||
|
@ -923,13 +920,11 @@ profile1 (FILE *ofile, pid_t pid)
|
||||||
case STATUS_BREAKPOINT:
|
case STATUS_BREAKPOINT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef __x86_64__
|
|
||||||
case STATUS_GCC_THROW:
|
case STATUS_GCC_THROW:
|
||||||
case STATUS_GCC_UNWIND:
|
case STATUS_GCC_UNWIND:
|
||||||
case STATUS_GCC_FORCED:
|
case STATUS_GCC_FORCED:
|
||||||
status = DBG_EXCEPTION_NOT_HANDLED;
|
status = DBG_EXCEPTION_NOT_HANDLED;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
status = DBG_EXCEPTION_NOT_HANDLED;
|
status = DBG_EXCEPTION_NOT_HANDLED;
|
||||||
|
|
|
@ -49,12 +49,7 @@ typedef DWORD64 CONTEXT_REG;
|
||||||
#define CONTEXT_REG_FMT "%016llx"
|
#define CONTEXT_REG_FMT "%016llx"
|
||||||
#define ADDR_SSCANF_FMT "%lli"
|
#define ADDR_SSCANF_FMT "%lli"
|
||||||
#else
|
#else
|
||||||
#define KERNEL_ADDR 0x77000000
|
#error unimplemented for this target
|
||||||
#define CONTEXT_SP Esp
|
|
||||||
#define CONTEXT_IP Eip
|
|
||||||
typedef DWORD CONTEXT_REG;
|
|
||||||
#define CONTEXT_REG_FMT "%08lx"
|
|
||||||
#define ADDR_SSCANF_FMT "%li"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TRACE_SSP 0
|
#define TRACE_SSP 0
|
||||||
|
@ -263,10 +258,7 @@ dump_registers (HANDLE thread)
|
||||||
printf ("esi %016llx edi %016llx ebp %016llx esp %016llx %016llx\n",
|
printf ("esi %016llx edi %016llx ebp %016llx esp %016llx %016llx\n",
|
||||||
context.Rsi, context.Rdi, context.Rbp, context.Rsp, context.Rip);
|
context.Rsi, context.Rdi, context.Rbp, context.Rsp, context.Rip);
|
||||||
#else
|
#else
|
||||||
printf ("eax %08lx ebx %08lx ecx %08lx edx %08lx eip\n",
|
#error unimplemented for this target
|
||||||
context.Eax, context.Ebx, context.Ecx, context.Edx);
|
|
||||||
printf ("esi %08lx edi %08lx ebp %08lx esp %08lx %08lx\n",
|
|
||||||
context.Esi, context.Edi, context.Ebp, context.Esp, context.Eip);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,8 +939,7 @@ main (int argc, char **argv)
|
||||||
/* 1234567 123% 1234567 123% 1234567812345678 xxxxxxxxxxx */
|
/* 1234567 123% 1234567 123% 1234567812345678 xxxxxxxxxxx */
|
||||||
printf (" Main-Thread Other-Thread BaseAddr DLL Name\n");
|
printf (" Main-Thread Other-Thread BaseAddr DLL Name\n");
|
||||||
#else
|
#else
|
||||||
/* 1234567 123% 1234567 123% 12345678 xxxxxxxxxxx */
|
#error unimplemented for this target
|
||||||
printf (" Main-Thread Other-Thread BaseAddr DLL Name\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
total_pcount = 0;
|
total_pcount = 0;
|
||||||
|
|
Loading…
Reference in New Issue