Fixed printing of 64-bit values forma. When compiling with cygwin with -mno-cygwin option the format should be like in MSVC
This commit is contained in:
parent
f2fc4bbe5a
commit
83300a66dd
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
CC="gcc"
|
CC="gcc"
|
||||||
CXX="g++"
|
CXX="g++"
|
||||||
CFLAGS="-O3 -march=pentium"
|
CFLAGS="-O3 -Wall -Wno-format -march=pentium"
|
||||||
CXXFLAGS="$CFLAGS"
|
CXXFLAGS="$CFLAGS"
|
||||||
|
|
||||||
export CC
|
export CC
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: instrument.cc,v 1.15 2006-01-16 19:53:11 sshwarts Exp $
|
// $Id: instrument.cc,v 1.16 2006-01-17 18:17:01 sshwarts Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||||
@ -98,34 +98,25 @@ void bx_instr_new_instruction(unsigned cpu)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "----------------------------------------------------------\n");
|
fprintf(stderr, "----------------------------------------------------------\n");
|
||||||
fprintf(stderr, "CPU: %d: %s\n", cpu, disasm_tbuf);
|
fprintf(stderr, "CPU: %d: %s\n", cpu, disasm_tbuf);
|
||||||
fprintf(stderr, "LEN: %d\tPREFIX: %d\tBYTES: ", length, i->nprefixes);
|
fprintf(stderr, "LEN: %d\tPREFIXES: %d\tBYTES: ", length, i->nprefixes);
|
||||||
for(n=0;n<length;n++) fprintf(stderr, "%02x", i->opcode[n]);
|
for(n=0;n<length;n++) fprintf(stderr, "%02x", i->opcode[n]);
|
||||||
if(i->is_branch)
|
if(i->is_branch)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\tBRANCH ");
|
fprintf(stderr, "\tBRANCH ");
|
||||||
|
|
||||||
if(i->is_taken)
|
if(i->is_taken)
|
||||||
fprintf(stderr, "TARGET %08x (TAKEN)", i->target_linear);
|
fprintf(stderr, "TARGET " FMT_ADDRX " (TAKEN)", i->target_linear);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "(NOT TAKEN)");
|
fprintf(stderr, "(NOT TAKEN)");
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\nMEMORY ACCESSES: %u\n", i->num_data_accesses);
|
fprintf(stderr, "\n");
|
||||||
for(n=0;n<i->num_data_accesses;n++)
|
for(n=0;n<i->num_data_accesses;n++)
|
||||||
{
|
{
|
||||||
#if BX_SUPPORT_X86_64
|
fprintf(stderr, "MEM ACCESS[%u]: " FMT_ADDRX " (linear) 0x%08x (physical) %s SIZE: %d\n", n,
|
||||||
fprintf(stderr, "MEM ACCESS: %08x%08x (linear) %08x (physical) %s SIZE: %d\n",
|
|
||||||
(Bit32u)(i->data_access[n].laddr >> 32),
|
|
||||||
(Bit32u)(i->data_access[n].laddr & 0xffffffff),
|
|
||||||
i->data_access[n].paddr,
|
|
||||||
i->data_access[n].op == BX_READ ? "RD":"WR",
|
|
||||||
i->data_access[n].size);
|
|
||||||
#else
|
|
||||||
fprintf(stderr, "MEM ACCESS: %08x (linear) %08x (physical) %s SIZE: %d\n",
|
|
||||||
i->data_access[n].laddr,
|
i->data_access[n].laddr,
|
||||||
i->data_access[n].paddr,
|
i->data_access[n].paddr,
|
||||||
i->data_access[n].op == BX_READ ? "RD":"WR",
|
i->data_access[n].op == BX_READ ? "RD":"WR",
|
||||||
i->data_access[n].size);
|
i->data_access[n].size);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: instrument.cc,v 1.11 2006-01-16 19:53:11 sshwarts Exp $
|
// $Id: instrument.cc,v 1.12 2006-01-17 18:17:01 sshwarts Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||||
@ -64,34 +64,25 @@ void bxInstrumentation::bx_instr_new_instruction()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "----------------------------------------------------------\n");
|
fprintf(stderr, "----------------------------------------------------------\n");
|
||||||
fprintf(stderr, "CPU: %d: %s\n", cpu_id, disasm_tbuf);
|
fprintf(stderr, "CPU: %d: %s\n", cpu_id, disasm_tbuf);
|
||||||
fprintf(stderr, "LEN: %d\tPREFIX: %d\tBYTES: ", length, nprefixes);
|
fprintf(stderr, "LEN: %d\tPREFIXES: %d\tBYTES: ", length, nprefixes);
|
||||||
for(n=0;n<length;n++) fprintf(stderr, "%02x", opcode[n]);
|
for(n=0;n<length;n++) fprintf(stderr, "%02x", opcode[n]);
|
||||||
if(is_branch)
|
if(is_branch)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\tBRANCH ");
|
fprintf(stderr, "\tBRANCH ");
|
||||||
|
|
||||||
if(is_taken)
|
if(is_taken)
|
||||||
fprintf(stderr, "TARGET %08x (TAKEN)", target_linear);
|
fprintf(stderr, "TARGET " FMT_ADDRX " (TAKEN)", target_linear);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "(NOT TAKEN)");
|
fprintf(stderr, "(NOT TAKEN)");
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\nMEMORY ACCESSES: %u\n", num_data_accesses);
|
fprintf(stderr, "\n");
|
||||||
for(n=0;n < num_data_accesses;n++)
|
for(n=0;n < num_data_accesses;n++)
|
||||||
{
|
{
|
||||||
#if BX_SUPPORT_X86_64
|
fprintf(stderr, "MEM ACCESS[%u]: " FMT_ADDRX " (linear) 0x%08x (physical) %s SIZE: %d\n", n,
|
||||||
fprintf(stderr, "MEM ACCESS %u: %08x%08x (linear) %08x (physical) %s SIZE: %d\n", n,
|
data_access[n].laddr,
|
||||||
(Bit32u)(data_access[n].laddr >> 32),
|
|
||||||
(Bit32u)(data_access[n].laddr & 0xffffffff),
|
|
||||||
data_access[n].paddr,
|
data_access[n].paddr,
|
||||||
data_access[n].op == BX_READ ? "RD":"WR",
|
data_access[n].op == BX_READ ? "RD":"WR",
|
||||||
data_access[n].size);
|
data_access[n].size);
|
||||||
#else
|
|
||||||
fprintf(stderr, "MEM ACCESS %u: %08x (linear) %08x (physical) %s SIZE: %d\n", n,
|
|
||||||
i->data_access[n].laddr,
|
|
||||||
i->data_access[n].paddr,
|
|
||||||
i->data_access[n].op == BX_READ ? "RD":"WR",
|
|
||||||
i->data_access[n].size);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: osdep.h,v 1.23 2004-09-19 18:38:09 vruppert Exp $
|
// $Id: osdep.h,v 1.24 2006-01-17 18:17:01 sshwarts Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||||
@ -52,12 +52,20 @@ extern "C" {
|
|||||||
# define ssize_t long
|
# define ssize_t long
|
||||||
|
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
#define FMT_LL "%I64"
|
|
||||||
#define FMT_TICK "%011I64u"
|
|
||||||
|
|
||||||
// Definitions that are needed for WIN32 compilers EXCEPT FOR
|
// Definitions that are needed for WIN32 compilers EXCEPT FOR
|
||||||
// cygwin compiling with -mno-cygwin. e.g. VC++.
|
// cygwin compiling with -mno-cygwin. e.g. VC++.
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER) // gcc without -mno-cygwin
|
||||||
|
#define FMT_LL "%ll"
|
||||||
|
#define FMT_TICK "%011llu"
|
||||||
|
#define FMT_ADDRX64 "0x%016llx"
|
||||||
|
#else
|
||||||
|
#define FMT_LL "%I64"
|
||||||
|
#define FMT_TICK "%011I64u"
|
||||||
|
#define FMT_ADDRX64 "0x%016I64x"
|
||||||
|
#endif
|
||||||
|
|
||||||
// always return regular file.
|
// always return regular file.
|
||||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||||
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||||
@ -77,18 +85,23 @@ extern "C" {
|
|||||||
#define stat _stati64
|
#define stat _stati64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* ifndef __MINGW32__ */
|
#else /* __MINGW32__ defined */
|
||||||
#define FMT_LL "%ll"
|
// Definitions for cygwin compiled with -mno-cygwin
|
||||||
#define FMT_TICK "%011llu"
|
#define FMT_LL "%I64"
|
||||||
|
#define FMT_TICK "%011I64u"
|
||||||
|
#define FMT_ADDRX64 "0x%016I64x"
|
||||||
|
|
||||||
#define off_t __int64
|
#define off_t __int64
|
||||||
#define lseek _lseeki64
|
#define lseek _lseeki64
|
||||||
|
#endif /* __MINGW32__ defined */
|
||||||
|
|
||||||
#endif /* ifndef __MINGW32__ */
|
#else /* not WIN32 definitions */
|
||||||
#else /* WIN32 */
|
|
||||||
#define FMT_LL "%ll"
|
#define FMT_LL "%ll"
|
||||||
#define FMT_TICK "%011llu"
|
#define FMT_TICK "%011llu"
|
||||||
#endif /* WIN32 */
|
#define FMT_ADDRX64 "0x%016llx"
|
||||||
|
#endif /* not WIN32 definitions */
|
||||||
|
|
||||||
|
#define FMT_ADDRX32 "0x%08x"
|
||||||
|
|
||||||
// Missing defines for open
|
// Missing defines for open
|
||||||
#ifndef S_IRUSR
|
#ifndef S_IRUSR
|
||||||
|
Loading…
Reference in New Issue
Block a user