Cleanup formatting on some files. Remove excessive whitespace.

This commit is contained in:
Christopher Faylor 2000-10-28 05:00:00 +00:00
parent 3c952fed3f
commit eedc36cb12
15 changed files with 753 additions and 675 deletions

View File

@ -1,5 +1,5 @@
dnl Autoconf configure script for Cygwin utilities.
dnl Copyright 1996, 1997 Cygnus Solutions.
dnl Copyright 1996, 1997, 1998, 1999, 2000 Cygnus Solutions.
dnl
dnl This file is part of Cygwin.
dnl

View File

@ -29,8 +29,7 @@ typedef long long longlong;
typedef __int64 longlong;
#endif
const char *known_env_vars[] =
{
const char *known_env_vars[] = {
"c_include_path",
"compiler_path",
"cxx_include_path",
@ -55,21 +54,45 @@ const char *known_env_vars[] =
0
};
struct {
struct
{
const char *name;
int missing_is_good;
} common_apps[] = {
{ "bash", 0 },
{ "cat", 0 },
{ "cpp", 1 },
{ "find", 0 },
{ "gcc", 0 },
{ "gdb", 0 },
{ "ld", 0 },
{ "ls", 0 },
{ "make", 0 },
{ "sh", 0 },
{ 0, 0 }
}
common_apps[] =
{
{
"bash", 0}
,
{
"cat", 0}
,
{
"cpp", 1}
,
{
"find", 0}
,
{
"gcc", 0}
,
{
"gdb", 0}
,
{
"ld", 0}
,
{
"ls", 0}
,
{
"make", 0}
,
{
"sh", 0}
,
{
0, 0}
};
int num_paths = 0, max_paths = 0;
@ -339,8 +362,10 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse)
int nsections = get_word (fh, pe_header_offset + 4 + 2);
char *sections = (char *) malloc (nsections * 40);
SetFilePointer (fh, pe_header_offset + 4 + 20 + get_word (fh, pe_header_offset + 4 + 16),
0, FILE_BEGIN);
SetFilePointer (fh,
pe_header_offset + 4 + 20 + get_word (fh,
pe_header_offset + 4 +
16), 0, FILE_BEGIN);
ReadFile (fh, sections, nsections * 40, &junk, 0);
if (verbose && num_entries >= 1 && export_size > 0)
@ -436,7 +461,8 @@ track_down (char *file, char *suffix, int lvl)
printf ("%s", path);
HANDLE fh = CreateFile (path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
HANDLE fh =
CreateFile (path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (fh == INVALID_HANDLE_VALUE)
{
@ -462,8 +488,7 @@ ls (char *f)
FileTimeToSystemTime (&info.ftLastWriteTime, &systime);
printf ("%5dk %04d/%02d/%02d %s",
(((int) info.nFileSizeLow) + 512) / 1024,
systime.wYear, systime.wMonth, systime.wDay,
f);
systime.wYear, systime.wMonth, systime.wDay, f);
dll_info (f, h, 16, 0);
CloseHandle (h);
@ -538,8 +563,7 @@ scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
#if 0
char tmp[400];
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError (),
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), tmp,
400, 0);
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), tmp, 400, 0);
printf ("RegQueryInfoKey: %s\n", tmp);
#endif
return;
@ -574,16 +598,6 @@ scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
break;
}
}
#if 0
else
{
char tmp[400];
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError (),
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), tmp,
400, 0);
printf ("RegEnumValue: %s\n", tmp);
}
#endif
}
free (value_name);
free (value_data);
@ -592,7 +606,8 @@ scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
char *subkey_name = (char *) malloc (max_subkey_len + 1);
for (i = 0; i < num_subkeys; i++)
{
if (RegEnumKey (hKey, i, subkey_name, max_subkey_len + 1) == ERROR_SUCCESS)
if (RegEnumKey (hKey, i, subkey_name, max_subkey_len + 1) ==
ERROR_SUCCESS)
{
HKEY sKey;
if (RegOpenKeyEx (hKey, subkey_name, 0, KEY_ALL_ACCESS, &sKey)
@ -746,7 +761,8 @@ dump_sysinfo ()
printf ("Listing available drives...\n");
printf ("Drv Type Size Free Flags Name\n");
}
int prev_mode = SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
int prev_mode =
SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
int drivemask = GetLogicalDrives ();
HINSTANCE k32 = LoadLibrary ("kernel32.dll");
@ -790,8 +806,7 @@ dump_sysinfo ()
int percent_full = -1;
long long free_me = 0ULL, free_bytes = 0ULL, total_bytes = 1ULL;
if (gdfse != NULL
&& gdfse (drive, & free_me, & total_bytes, & free_bytes))
if (gdfse != NULL && gdfse (drive, &free_me, &total_bytes, &free_bytes))
{
capacity_mb = total_bytes / (1024L * 1024L);
percent_full = 100 - (int) ((100.0 * free_me) / total_bytes);
@ -834,7 +849,8 @@ dump_sysinfo ()
{
printf ("fd=floppy, hd=hard drive, cd=CD-ROM, net=Network Share\n");
printf ("CP=Case Preserving, CS=Case Sensitive, UN=Unicode\n");
printf ("PA=Persistent ACLS, FC=File Compression, VC=Volume Compression\n");
printf
("PA=Persistent ACLS, FC=File Compression, VC=Volume Compression\n");
}
printf ("\n");
@ -842,10 +858,9 @@ dump_sysinfo ()
if (givehelp)
{
printf ("Mount entries: these map POSIX directories to your NT drives.\n");
printf ("%-*s %-*s %-*s %s\n",
ml_fsname, "-NT-",
ml_dir, "-POSIX-",
printf
("Mount entries: these map POSIX directories to your NT drives.\n");
printf ("%-*s %-*s %-*s %s\n", ml_fsname, "-NT-", ml_dir, "-POSIX-",
ml_type, "-Type-", "-Flags-");
}
@ -856,16 +871,15 @@ dump_sysinfo ()
{
printf ("%-*s %-*s %-*s %s\n",
ml_fsname, mnt->mnt_fsname,
ml_dir, mnt->mnt_dir,
ml_type, mnt->mnt_type,
mnt->mnt_opts);
ml_dir, mnt->mnt_dir, ml_type, mnt->mnt_type, mnt->mnt_opts);
}
printf ("\n");
add_path ((char *) "\\bin", 4); /* just in case */
if (givehelp)
printf ("Looking to see where common programs can be found, if at all...\n");
printf
("Looking to see where common programs can be found, if at all...\n");
for (i = 0; common_apps[i].name; i++)
if (!find_on_path ((char *) common_apps[i].name, (char *) ".exe", 1, 0))
{
@ -999,16 +1013,20 @@ check_keys ()
CloseHandle (h);
return 0;
}
void
usage ()
{
fprintf (stderr, "Usage: cygcheck [OPTIONS] [program ...]\n");
fprintf (stderr, " -s, --sysinfo = system information (not with -k)\n");
fprintf (stderr, " -v, --verbose = verbose output (indented) (for -s or programs)\n");
fprintf (stderr,
" -v, --verbose = verbose output (indented) (for -s or programs)\n");
fprintf (stderr, " -r, --registry = registry search (requires -s)\n");
fprintf (stderr, " -k, --keycheck = perform a keyboard check session (not with -s)\n");
fprintf (stderr,
" -k, --keycheck = perform a keyboard check session (not with -s)\n");
fprintf (stderr, " -h, --help = give help about the info\n");
fprintf (stderr, "You must at least give either -s or -k or a program name\n");
fprintf (stderr,
"You must at least give either -s or -k or a program name\n");
exit (1);
}
@ -1047,8 +1065,7 @@ main (int argc, char **argv)
break;
default:
usage ();
/*NOTREACHED*/
}
/*NOTREACHED*/}
argc -= optind;
argv += optind;
@ -1067,12 +1084,14 @@ main (int argc, char **argv)
{
if (argc == 1)
{
printf ("Here is where the OS will find your program, and which dlls\n");
printf
("Here is where the OS will find your program, and which dlls\n");
printf ("will be used for it. Use -v to see DLL version info\n");
}
else
{
printf ("Here is where the OS will find your programs, and which dlls\n");
printf
("Here is where the OS will find your programs, and which dlls\n");
printf ("will be used for them. Use -v to see DLL version info\n");
}

View File

@ -40,7 +40,8 @@ BOOL verbose = FALSE;
int deb_printf (const char *format,...)
{
if ( !verbose ) return 0;
if (!verbose)
return 0;
va_list va;
va_start (va, format);
int ret_val = vprintf (format, va);
@ -74,7 +75,8 @@ dumper::dumper ( DWORD pid, DWORD tid, const char* file_name )
init_core_dump ();
if ( ! sane () ) dumper_abort ();
if (!sane ())
dumper_abort ();
}
dumper: :~dumper ()
@ -93,9 +95,12 @@ dumper::dumper_abort ()
void
dumper::close ()
{
if ( core_bfd ) bfd_close ( core_bfd );
if ( excl_list ) delete excl_list;
if ( hProcess ) CloseHandle ( hProcess );
if (core_bfd)
bfd_close (core_bfd);
if (excl_list)
delete excl_list;
if (hProcess)
CloseHandle (hProcess);
core_bfd = NULL;
hProcess = NULL;
excl_list = NULL;
@ -104,17 +109,20 @@ dumper::close ()
int
dumper::sane ()
{
if ( hProcess == NULL || core_bfd == NULL || excl_list == NULL ) return 0;
if (hProcess == NULL || core_bfd == NULL || excl_list == NULL)
return 0;
return 1;
}
process_entity *
dumper::add_process_entity_to_list (process_entity_type type)
{
if ( ! sane () ) return NULL;
if (!sane ())
return NULL;
process_entity *new_entity = (process_entity *) malloc (sizeof (process_entity));
if ( new_entity == NULL ) return NULL;
if (new_entity == NULL)
return NULL;
new_entity->next = NULL;
new_entity->section = NULL;
if (last == NULL)
@ -128,12 +136,14 @@ dumper::add_process_entity_to_list ( process_entity_type type )
int
dumper::add_thread (DWORD tid, HANDLE hThread)
{
if ( ! sane () ) return 0 ;
if (!sane ())
return 0;
CONTEXT *pcontext;
process_entity *new_entity = add_process_entity_to_list (pr_ent_thread);
if ( new_entity == NULL ) return 0;
if (new_entity == NULL)
return 0;
new_entity->type = pr_ent_thread;
thread_num++;
@ -142,7 +152,8 @@ dumper::add_thread ( DWORD tid, HANDLE hThread )
pcontext = &(new_entity->u.thread.context);
pcontext->ContextFlags = CONTEXT_FULL | CONTEXT_FLOATING_POINT;
if ( ! GetThreadContext ( hThread, pcontext ) ) return 0;
if (!GetThreadContext (hThread, pcontext))
return 0;
deb_printf ("added thread %u\n", tid);
return 1;
@ -151,12 +162,15 @@ dumper::add_thread ( DWORD tid, HANDLE hThread )
int
dumper::add_mem_region (LPBYTE base, DWORD size)
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
if ( base == NULL || size == 0 ) return 1; // just ignore empty regions
if (base == NULL || size == 0)
return 1; // just ignore empty regions
process_entity *new_entity = add_process_entity_to_list (pr_ent_memory);
if ( new_entity == NULL ) return 0;
if (new_entity == NULL)
return 0;
new_entity->type = pr_ent_memory;
memory_num++;
@ -167,16 +181,16 @@ dumper::add_mem_region ( LPBYTE base, DWORD size )
return 1;
}
/*
* split_add_mem_region scans list of regions to be excluded from dumping process
* (excl_list) and removes all "excluded" parts from given region
*/
/* split_add_mem_region scans list of regions to be excluded from dumping process
(excl_list) and removes all "excluded" parts from given region. */
int
dumper::split_add_mem_region (LPBYTE base, DWORD size)
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
if ( base == NULL || size == 0 ) return 1; // just ignore empty regions
if (base == NULL || size == 0)
return 1; // just ignore empty regions
LPBYTE last_base = base;
@ -184,7 +198,8 @@ dumper::split_add_mem_region ( LPBYTE base, DWORD size )
p < excl_list->region + excl_list->last;
p++)
{
if ( p->base >= base + size || p->base + p->size <= base ) continue;
if (p->base >= base + size || p->base + p->size <= base)
continue;
if (p->base <= base)
{
@ -205,13 +220,16 @@ dumper::split_add_mem_region ( LPBYTE base, DWORD size )
int
dumper::add_module (LPVOID base_address)
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
char *module_name = psapi_get_module_name (hProcess, (DWORD) base_address);
if ( module_name == NULL ) return 1;
if (module_name == NULL)
return 1;
process_entity *new_entity = add_process_entity_to_list (pr_ent_module);
if ( new_entity == NULL ) return 0;
if (new_entity == NULL)
return 0;
new_entity->type = pr_ent_module;
module_num++;
@ -229,7 +247,8 @@ dumper::add_module ( LPVOID base_address )
int
dumper::collect_memory_sections ()
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
LPBYTE current_page_address;
LPBYTE last_base = (LPBYTE) 0xFFFFFFFF;
@ -240,7 +259,8 @@ dumper::collect_memory_sections ()
MEMORY_BASIC_INFORMATION mbi;
if ( hProcess == NULL ) return 0;
if (hProcess == NULL)
return 0;
for (current_page_address = 0; current_page_address < (LPBYTE) 0xFFFF0000;)
{
@ -250,7 +270,8 @@ dumper::collect_memory_sections ()
int skip_region_p = 0;
if (mbi.Protect & (PAGE_NOACCESS | PAGE_GUARD) ||
mbi.State != MEM_COMMIT ) skip_region_p = 1;
mbi.State != MEM_COMMIT)
skip_region_p = 1;
if (!skip_region_p)
{
@ -272,7 +293,8 @@ dumper::collect_memory_sections ()
pt[9] = (mbi.Protect & PAGE_NOCACHE) ? "NC " : "";
char buf[10 * 6];
buf[0] = '\0';
for ( int i = 0 ; i < 10 ; i++ ) strcat ( buf, pt[i] );
for (int i = 0; i < 10; i++)
strcat (buf, pt[i]);
deb_printf ("warning: failed to read memory at %08x-%08x. protect = %s\n",
(DWORD) current_page_address,
@ -311,7 +333,8 @@ dumper::collect_memory_sections ()
int
dumper::dump_memory_region (asection * to, process_mem_region * memory)
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
DWORD size = memory->size;
DWORD todo;
@ -319,7 +342,8 @@ dumper::dump_memory_region ( asection* to, process_mem_region* memory )
LPBYTE pos = memory->base;
DWORD sect_pos = 0;
if ( to == NULL || memory == NULL ) return 0;
if (to == NULL || memory == NULL)
return 0;
char mem_buf[PAGE_BUFFER_SIZE];
@ -347,9 +371,11 @@ dumper::dump_memory_region ( asection* to, process_mem_region* memory )
int
dumper::dump_thread (asection * to, process_thread * thread)
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
if ( to == NULL || thread == NULL ) return 0;
if (to == NULL || thread == NULL)
return 0;
win32_pstatus thread_pstatus;
@ -396,9 +422,11 @@ dumper::dump_thread ( asection* to, process_thread* thread )
int
dumper::dump_module (asection * to, process_module * module)
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
if ( to == NULL || module == NULL ) return 0;
if (to == NULL || module == NULL)
return 0;
struct win32_pstatus *module_pstatus_ptr;
@ -438,7 +466,8 @@ dumper::dump_module ( asection* to, process_module* module )
return 1;
out:
if ( buf ) free ( buf );
if (buf)
free (buf);
dumper_abort ();
return 0;
@ -447,7 +476,8 @@ out:
int
dumper::collect_process_information ()
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
if (!DebugActiveProcess (pid))
{
@ -463,7 +493,8 @@ dumper::collect_process_information ()
while (1)
{
if ( ! WaitForDebugEvent ( &current_event, 20000 ) ) return 0;
if (!WaitForDebugEvent (&current_event, 20000))
return 0;
switch (current_event.dwDebugEventCode)
{
@ -521,7 +552,8 @@ dumper::collect_process_information ()
};
/* signal a debugee that we've finished */
if ( sync_with_debugee ) SetEvent ( sync_with_debugee );
if (sync_with_debugee)
SetEvent (sync_with_debugee);
break;
@ -537,7 +569,8 @@ dumper::collect_process_information ()
}
failed:
/* set debugee free */
if ( sync_with_debugee ) SetEvent ( sync_with_debugee );
if (sync_with_debugee)
SetEvent (sync_with_debugee);
return 0;
}
@ -571,7 +604,8 @@ failed:
int
dumper::prepare_core_dump ()
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
int sect_no = 0;
char sect_name[50];
@ -657,11 +691,13 @@ failed:
int
dumper::write_core_dump ()
{
if ( ! sane () ) return 0;
if (!sane ())
return 0;
for (process_entity * p = list; p != NULL; p = p->next)
{
if ( p->section == NULL ) continue;
if (p->section == NULL)
continue;
deb_printf ("writing section type=%u base=%08x size=%08x flags=%08x\n",
p->type,

View File

@ -8,7 +8,8 @@
#include <sys/acl.h>
#include <sys/stat.h>
char *permstr (mode_t perm)
char *
permstr (mode_t perm)
{
static char pbuf[4];
@ -20,7 +21,8 @@ char *permstr (mode_t perm)
}
#if 0
char *username (uid_t uid)
char *
username (uid_t uid)
{
static char ubuf[256];
struct passwd *pw;
@ -31,7 +33,8 @@ char *username (uid_t uid)
strcpy (ubuf, "<unknown>");
}
char *groupname (gid_t gid)
char *
groupname (gid_t gid)
{
static char gbuf[256];
struct group *gr;
@ -121,4 +124,3 @@ main (int argc, char **argv)
}
return 0;
}

View File

@ -17,18 +17,19 @@ details. */
static int psapi_loaded = 0;
static HMODULE psapi_module_handle = NULL;
typedef BOOL WINAPI (tf_EnumProcessModules ) ( HANDLE, HMODULE*, DWORD, LPDWORD );
typedef BOOL WINAPI (tf_GetModuleInformation) ( HANDLE, HMODULE, LPMODULEINFO, DWORD );
typedef DWORD WINAPI (tf_GetModuleFileNameExA) ( HANDLE, HMODULE, LPSTR, DWORD );
typedef BOOL WINAPI (tf_EnumProcessModules) (HANDLE, HMODULE *, DWORD,
LPDWORD);
typedef BOOL WINAPI (tf_GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO,
DWORD);
typedef DWORD WINAPI (tf_GetModuleFileNameExA) (HANDLE, HMODULE, LPSTR,
DWORD);
static tf_EnumProcessModules *psapi_EnumProcessModules = NULL;
static tf_GetModuleInformation *psapi_GetModuleInformation = NULL;
static tf_GetModuleFileNameExA *psapi_GetModuleFileNameExA = NULL;
/*
* Returns full name of Dll, which is loaded by hProcess at BaseAddress
* Uses psapi.dll
*/
/* Returns full name of Dll, which is loaded by hProcess at BaseAddress.
Uses psapi.dll. */
char *
psapi_get_module_name (HANDLE hProcess, DWORD BaseAddress)
@ -48,31 +49,36 @@ psapi_get_module_name ( HANDLE hProcess, DWORD BaseAddress )
psapi_GetModuleInformation == NULL ||
psapi_GetModuleFileNameExA == NULL)
{
if ( psapi_loaded ) goto failed;
if (psapi_loaded)
goto failed;
psapi_loaded = 1;
psapi_module_handle = LoadLibrary ("psapi.dll");
if (!psapi_module_handle)
goto failed;
psapi_EnumProcessModules = (tf_EnumProcessModules *) GetProcAddress ( psapi_module_handle, "EnumProcessModules" );
psapi_GetModuleInformation = (tf_GetModuleInformation *) GetProcAddress ( psapi_module_handle, "GetModuleInformation" );
psapi_GetModuleFileNameExA = (tf_GetModuleFileNameExA*) GetProcAddress ( psapi_module_handle, "GetModuleFileNameExA" );
if ( psapi_EnumProcessModules == NULL ||
psapi_GetModuleInformation == NULL ||
psapi_GetModuleFileNameExA == NULL ) goto failed;
psapi_EnumProcessModules =
(tf_EnumProcessModules *) GetProcAddress (psapi_module_handle,
"EnumProcessModules");
psapi_GetModuleInformation =
(tf_GetModuleInformation *) GetProcAddress (psapi_module_handle,
"GetModuleInformation");
psapi_GetModuleFileNameExA =
(tf_GetModuleFileNameExA *) GetProcAddress (psapi_module_handle,
"GetModuleFileNameExA");
if (psapi_EnumProcessModules == NULL
|| psapi_GetModuleInformation == NULL
|| psapi_GetModuleFileNameExA == NULL)
goto failed;
}
ok = (*psapi_EnumProcessModules) (hProcess,
DllHandle,
sizeof ( HMODULE ),
&cbNeeded );
DllHandle, sizeof (HMODULE), &cbNeeded);
if ( !ok || !cbNeeded ) goto failed;
if (!ok || !cbNeeded)
goto failed;
DllHandle = (HMODULE *) malloc (cbNeeded);
if ( ! DllHandle ) goto failed;
ok = (*psapi_EnumProcessModules) ( hProcess,
DllHandle,
cbNeeded,
&cbNeeded );
if (!DllHandle)
goto failed;
ok = (*psapi_EnumProcessModules) (hProcess, DllHandle, cbNeeded, &cbNeeded);
if (!ok)
{
free (DllHandle);
@ -82,18 +88,14 @@ psapi_get_module_name ( HANDLE hProcess, DWORD BaseAddress )
for (i = 0; i < cbNeeded / sizeof (HMODULE); i++)
{
if (!(*psapi_GetModuleInformation) (hProcess,
DllHandle [ i ],
&mi,
sizeof ( mi ) ) )
DllHandle[i], &mi, sizeof (mi)))
{
free (DllHandle);
goto failed;
}
len = (*psapi_GetModuleFileNameExA) (hProcess,
DllHandle [ i ],
name_buf,
MAX_PATH );
DllHandle[i], name_buf, MAX_PATH);
if (len == 0)
{
free (DllHandle);

View File

@ -19,16 +19,19 @@ details. */
int
exclusion::add (LPBYTE mem_base, DWORD mem_size)
{
while ( last >= size ) size += step;
while (last >= size)
size += step;
region = (process_mem_region *) realloc (region, size * sizeof (process_mem_region));
if ( region == NULL ) return 0;
if (region == NULL)
return 0;
region[last].base = mem_base;
region[last].size = mem_size;
last++;
return 1;
};
int cmp_regions ( const void* r1, const void* r2 )
int
cmp_regions (const void *r1, const void *r2)
{
if (((process_mem_region *) r1)->base < ((process_mem_region *) r2)->base)
return -1;
@ -69,7 +72,8 @@ select_data_section ( bfd *abfd, asection *sect, PTR obj )
int
parse_pe (const char *file_name, exclusion * excl_list)
{
if ( file_name == NULL || excl_list == NULL ) return 0;
if (file_name == NULL || excl_list == NULL)
return 0;
bfd *abfd = bfd_openr (file_name, "pei-i386");
if (abfd == NULL)
@ -85,4 +89,3 @@ parse_pe ( const char* file_name, exclusion* excl_list )
bfd_close (abfd);
return 1;
}

View File

@ -39,7 +39,9 @@ struct child_list
DWORD last_usecs;
struct child_list *next;
child_list ():id (0), hproc (NULL), saw_stars (0), nfields (0),
start_time (0), last_usecs (0), next (NULL) {}
start_time (0), last_usecs (0), next (NULL)
{
}
};
child_list children;
@ -140,9 +142,16 @@ public:
alloc = 0;
buf = NULL;
}
~linebuf () {if (buf) free (buf);}
~linebuf ()
{
if (buf)
free (buf);
}
void add (const char *what, int len);
void add (const char *what) {add (what, strlen (what));}
void add (const char *what)
{
add (what, strlen (what));
}
void prepend (const char *what, int len);
};
@ -243,23 +252,22 @@ create_child (char **argv)
/* cygwin32_conv_to_win32_path (exec_file, real_path); */
flags = forkdebug ? 0 : DEBUG_ONLY_THIS_PROCESS;
flags |= /*CREATE_NEW_PROCESS_GROUP | */CREATE_DEFAULT_ERROR_MODE | DEBUG_PROCESS;
flags |=
/*CREATE_NEW_PROCESS_GROUP | */ CREATE_DEFAULT_ERROR_MODE | DEBUG_PROCESS;
make_command_line (one_line, argv);
SetConsoleCtrlHandler (NULL, 0);
ret = CreateProcess (0,
one_line.buf,/* command line */
ret = CreateProcess (0, one_line.buf, /* command line */
NULL, /* Security */
NULL, /* thread */
TRUE, /* inherit handles */
flags, /* start flags */
NULL,
NULL, /* current directory */
&si,
&pi);
NULL, NULL, /* current directory */
&si, &pi);
if (!ret)
error (0, "error creating process %s, (error %d)", *argv, GetLastError());
error (0, "error creating process %s, (error %d)", *argv,
GetLastError ());
CloseHandle (pi.hThread);
CloseHandle (pi.hProcess);
@ -294,9 +302,7 @@ output_winerror (FILE *ofile, char *s)
NULL,
errnum,
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) buf,
sizeof (buf),
NULL))
(LPTSTR) buf, sizeof (buf), NULL))
return 0;
/* Get rid the trailing CR/NL pair. */
@ -341,7 +347,8 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
#ifndef DEBUGGING
return;
#else
error (0, "couldn't get message length from subprocess %d<%p>, windows error %d",
error (0,
"couldn't get message length from subprocess %d<%p>, windows error %d",
id, hchild, GetLastError ());
#endif
@ -379,7 +386,8 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
DWORD new_flag = 1;
if (!WriteProcessMemory (hchild, (LPVOID) n, &new_flag,
sizeof (new_flag), &nbytes))
error (0, "couldn't write strace flag to subprocess, windows error %d",
error (0,
"couldn't write strace flag to subprocess, windows error %d",
GetLastError ());
return;
}
@ -459,8 +467,10 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
if (*s == '*')
{
SYSTEMTIME *st = syst (child->start_time);
fprintf (ofile, "Date/Time: %d-%02d-%02d %02d:%02d:%02d\n",
st->wYear, st->wMonth, st->wDay, st->wHour, st->wMinute, st->wSecond);
fprintf (ofile,
"Date/Time: %d-%02d-%02d %02d:%02d:%02d\n",
st->wYear, st->wMonth, st->wDay, st->wHour,
st->wMinute, st->wSecond);
child->saw_stars++;
}
}
@ -537,7 +547,8 @@ proc_child (unsigned mask, FILE *ofile)
remove_child (ev.dwProcessId);
break;
case EXCEPTION_DEBUG_EVENT:
if (ev.u.Exception.ExceptionRecord.ExceptionCode != STATUS_BREAKPOINT)
if (ev.u.Exception.ExceptionRecord.ExceptionCode !=
STATUS_BREAKPOINT)
{
status = DBG_EXCEPTION_NOT_HANDLED;
#if 0

View File

@ -27,13 +27,18 @@ static void
usage (void)
{
fprintf (stderr, "Usage %s [-s] <posixpath>\n", progname);
fprintf (stderr, "-s = remove mount point from system-wide registry location\n");
fprintf (stderr,
"-s = remove mount point from system-wide registry location\n");
fprintf (stderr, "\n");
fprintf (stderr, "--remove-all-mounts = remove all mounts\n");
fprintf (stderr, "--remove-auto-mounts = remove all automatically mounted mounts\n");
fprintf (stderr, "--remove-user-mounts = remove all mounts in the current user mount registry area, including auto mounts\n");
fprintf (stderr, "--remove-system-mounts = remove all mounts in the system-wide mount registry area\n");
fprintf (stderr, "[-s] --remove-cygdrive-prefix = remove cygdrive path prefix\n");
fprintf (stderr,
"--remove-auto-mounts = remove all automatically mounted mounts\n");
fprintf (stderr,
"--remove-user-mounts = remove all mounts in the current user mount registry area, including auto mounts\n");
fprintf (stderr,
"--remove-system-mounts = remove all mounts in the system-wide mount registry area\n");
fprintf (stderr,
"[-s] --remove-cygdrive-prefix = remove cygdrive path prefix\n");
exit (1);
}