winedump: Print file offset instead of obscure 'prefix' while dumping data
Dmitry Timoshkov
dmitry at baikal.ru
Sat May 21 04:43:58 CDT 2005
Hello,
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Print file offset instead of obscure 'prefix' while dumping data.
diff -up cvs/hq/wine/tools/winedump/dump.c wine/tools/winedump/dump.c
--- cvs/hq/wine/tools/winedump/dump.c 2005-05-08 14:59:37.000000000 +0900
+++ wine/tools/winedump/dump.c 2005-05-21 18:32:07.000000000 +0900
@@ -53,16 +53,18 @@
static void* dump_base;
static unsigned long dump_total_len;
-void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix )
+void dump_data( const unsigned char *ptr, unsigned int size )
{
unsigned int i, j;
- printf( "%s", prefix );
if (!ptr)
{
printf("NULL\n");
return;
}
+
+ printf( "%08x: ", 0 );
+
for (i = 0; i < size; i++)
{
printf( "%02x%c", ptr[i], (i % 16 == 7) ? '-' : ' ' );
@@ -71,7 +73,7 @@ void dump_data( const unsigned char *ptr
printf( " " );
for (j = 0; j < 16; j++)
printf( "%c", isprint(ptr[i-15+j]) ? ptr[i-15+j] : '.' );
- if (i < size-1) printf( "\n%s", prefix );
+ if (i < size-1) printf( "\n%08x: ", i + 1 );
}
}
if (i % 16)
diff -up cvs/hq/wine/tools/winedump/minidump.c wine/tools/winedump/minidump.c
--- cvs/hq/wine/tools/winedump/minidump.c 2005-03-07 19:03:53.000000000 +0800
+++ wine/tools/winedump/minidump.c 2005-05-21 18:25:09.000000000 +0900
@@ -29,10 +29,10 @@
#include "dbghelp.h"
#include "winedump.h"
-static void dump_mdmp_data(const MINIDUMP_LOCATION_DESCRIPTOR* md, const char* pfx)
+static void dump_mdmp_data(const MINIDUMP_LOCATION_DESCRIPTOR* md)
{
if (md->DataSize)
- dump_data(PRD(md->Rva, md->DataSize), md->DataSize, pfx);
+ dump_data(PRD(md->Rva, md->DataSize), md->DataSize);
}
static void dump_mdmp_string(DWORD rva)
@@ -106,9 +106,9 @@ void mdmp_dump(void)
printf(" Stack: 0x%llx-0x%llx\n",
mt->Stack.StartOfMemoryRange,
mt->Stack.StartOfMemoryRange + mt->Stack.Memory.DataSize);
- dump_mdmp_data(&mt->Stack.Memory, " ");
+ dump_mdmp_data(&mt->Stack.Memory);
printf(" ThreadContext:\n");
- dump_mdmp_data(&mt->ThreadContext, " ");
+ dump_mdmp_data(&mt->ThreadContext);
}
}
break;
@@ -197,9 +197,9 @@ void mdmp_dump(void)
printf(" dwFileDate: %lx%08lx\n",
mm->VersionInfo.dwFileDateMS, mm->VersionInfo.dwFileDateLS);
printf(" CvRecord: <%lu>\n", mm->CvRecord.DataSize);
- dump_mdmp_data(&mm->CvRecord, " ");
+ dump_mdmp_data(&mm->CvRecord);
printf(" MiscRecord: <%lu>\n", mm->MiscRecord.DataSize);
- dump_mdmp_data(&mm->MiscRecord, " ");
+ dump_mdmp_data(&mm->MiscRecord);
printf(" Reserved0: %llu\n", mm->Reserved0);
printf(" Reserved1: %llu\n", mm->Reserved1);
}
@@ -218,7 +218,7 @@ void mdmp_dump(void)
printf(" Range: 0x%llx-0x%llx\n",
mmd->StartOfMemoryRange,
mmd->StartOfMemoryRange + mmd->Memory.DataSize);
- dump_mdmp_data(&mmd->Memory, " ");
+ dump_mdmp_data(&mmd->Memory);
}
}
break;
@@ -357,7 +357,7 @@ void mdmp_dump(void)
mes->ExceptionRecord.ExceptionInformation[i]);
}
printf(" ThreadContext:\n");
- dump_mdmp_data(&mes->ThreadContext, " ");
+ dump_mdmp_data(&mes->ThreadContext);
}
break;
@@ -365,7 +365,7 @@ void mdmp_dump(void)
printf("NIY %ld\n", dir->StreamType);
printf(" RVA: %lu\n", dir->Location.Rva);
printf(" Size: %lu\n", dir->Location.DataSize);
- dump_mdmp_data(&dir->Location, " ");
+ dump_mdmp_data(&dir->Location);
break;
}
}
diff -up cvs/hq/wine/tools/winedump/ne.c wine/tools/winedump/ne.c
--- cvs/hq/wine/tools/winedump/ne.c 2005-05-21 18:29:43.000000000 +0900
+++ wine/tools/winedump/ne.c 2005-05-21 18:25:09.000000000 +0900
@@ -130,9 +130,9 @@ static void dump_ne_resources( const voi
if (info->type_id & 0x8000) printf( " %s", get_resource_type(info->type_id) );
else printf( " %.*s", *((const unsigned char *)res_ptr + info->type_id),
(const char *)res_ptr + info->type_id + 1 );
- printf(" flags %04x length %04x\n", name->flags, name->length << size_shift);
+ printf(" flags %04x\n", name->flags);
dump_data( (const unsigned char *)base + (name->offset << size_shift),
- name->length << size_shift, " " );
+ name->length << size_shift );
}
info = (const NE_TYPEINFO *)name;
}
diff -up cvs/hq/wine/tools/winedump/pe.c wine/tools/winedump/pe.c
--- cvs/hq/wine/tools/winedump/pe.c 2005-03-11 20:08:25.000000000 +0800
+++ wine/tools/winedump/pe.c 2005-05-21 18:25:09.000000000 +0900
@@ -829,7 +829,7 @@ static void dump_dir_resource(void)
data = (const IMAGE_RESOURCE_DATA_ENTRY *)((const char *)root + e3->u2.OffsetToData);
if (e1->u1.s1.NameIsString)
{
- dump_data( RVA( data->OffsetToData, data->Size ), data->Size, " " );
+ dump_data( RVA( data->OffsetToData, data->Size ), data->Size );
}
else switch(e1->u1.s2.Id)
{
@@ -842,7 +842,7 @@ static void dump_dir_resource(void)
e2->u1.s2.Id, " " );
break;
default:
- dump_data( RVA( data->OffsetToData, data->Size ), data->Size, " " );
+ dump_data( RVA( data->OffsetToData, data->Size ), data->Size );
break;
}
}
diff -up cvs/hq/wine/tools/winedump/winedump.h wine/tools/winedump/winedump.h
--- cvs/hq/wine/tools/winedump/winedump.h 2005-03-11 20:08:25.000000000 +0800
+++ wine/tools/winedump/winedump.h 2005-05-21 18:31:07.000000000 +0900
@@ -231,7 +231,7 @@ unsigned long Offset(void* ptr);
typedef void (*file_dumper)(enum FileSig, void*);
int dump_analysis(const char*, file_dumper, enum FileSig);
-void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix );
+void dump_data( const unsigned char *ptr, unsigned int size );
const char* get_time_str( unsigned long );
unsigned int strlenW( const unsigned short *str );
void dump_unicode_str( const unsigned short *str, int len );
More information about the wine-patches
mailing list