Skip to content

Commit

Permalink
Add a new LOG macro in SCC to avoid conflicts with other libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
staskau committed Mar 14, 2024
1 parent b9ee6c6 commit 9423dbb
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/iss/asmjit/jit_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class MyErrorHandler : public ErrorHandler {
translation_block getPointerToFunction(unsigned cluster_id, uint64_t phys_addr, std::function<void(jit_holder&)>& generator,
bool dumpEnabled) {
#ifndef NDEBUG
LOG(TRACE) << "Compiling and executing code for 0x" << std::hex << phys_addr << std::dec;
CPPLOG(TRACE) << "Compiling and executing code for 0x" << std::hex << phys_addr << std::dec;
#endif
static int i = 0;
JitRuntime rt;
Expand Down
10 changes: 5 additions & 5 deletions src/iss/asmjit/vm_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ template <typename ARCH> class vm_base : public debugger_if, public vm_if {
sync_exec = PRE_SYNC;
auto start = std::chrono::high_resolution_clock::now();
virt_addr_t pc(iss::access_type::DEBUG_FETCH, 0, get_reg<typename arch::traits<ARCH>::addr_t>(arch::traits<ARCH>::PC));
LOG(INFO) << "Start at 0x" << std::hex << pc.val << std::dec;
CPPLOG(INFO) << "Start at 0x" << std::hex << pc.val << std::dec;
try {
continuation_e cont = CONT;

Expand Down Expand Up @@ -170,23 +170,23 @@ template <typename ARCH> class vm_base : public debugger_if, public vm_if {
pc.val = core.enter_trap(ta.id, ta.addr, 0);
}
#ifndef NDEBUG
LOG(TRACE) << "continuing @0x" << std::hex << pc << std::dec;
CPPLOG(TRACE) << "continuing @0x" << std::hex << pc << std::dec;
#endif
// break; //for testing, only exec first block and end sim
}
} catch(simulation_stopped& e) {
LOG(INFO) << "ISS execution stopped with status 0x" << std::hex << e.state << std::dec;
CPPLOG(INFO) << "ISS execution stopped with status 0x" << std::hex << e.state << std::dec;
if(e.state != 1)
error = e.state;
} catch(decoding_error& e) {
LOG(ERR) << "ISS execution aborted at address 0x" << std::hex << e.addr << std::dec;
CPPLOG(ERR) << "ISS execution aborted at address 0x" << std::hex << e.addr << std::dec;
error = -1;
}
auto end = std::chrono::high_resolution_clock::now(); // end measurement
// here
auto elapsed = end - start;
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
LOG(INFO) << "Executed " << core.get_icount() << " instructions in " << func_map.size() << " code blocks during " << millis
CPPLOG(INFO) << "Executed " << core.get_icount() << " instructions in " << func_map.size() << " code blocks during " << millis
<< "ms resulting in " << (core.get_icount() * 0.001 / millis) << "MIPS";
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion src/iss/debugger/encoderdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::vector<uint8_t> encoder_decoder::dec_data(const char* in) {
for(count = 0; *in; count++, in += 2) {
if(*(in + 1) == '\0') {
/* Odd number of nibbles. Discard the last one */
LOG(WARN) << __FUNCTION__ << ": odd number of nibbles";
CPPLOG(WARN) << __FUNCTION__ << ": odd number of nibbles";
if(count == 0)
out.clear();
return out;
Expand Down
2 changes: 1 addition & 1 deletion src/iss/debugger/gdb_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void gdb_session::send_completed(const boost::system::error_code& e) {
if(!e) {
conn_shptr->async_read();
} else {
LOG(ERR) << e.message() << "(" << e << ")";
CPPLOG(ERR) << e.message() << "(" << e << ")";
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/iss/debugger/serialized_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ template <> class connection<std::string, std::string> : public boost::enable_sh
// Serialize the data first so we know how large it is.
outbound_data_ = str;
#ifdef EXTENDED_TRACE
LOG(TRACE) << "outbound async data with len " << outbound_data_.size() << ":'" << outbound_data_ << "'";
CPPLOG(TRACE) << "outbound async data with len " << outbound_data_.size() << ":'" << outbound_data_ << "'";
#endif
// Write the outbound data to the socket. We use "gather-write" to send
// both the header and the data in a single write operation.
Expand Down Expand Up @@ -339,7 +339,7 @@ template <> class connection<std::string, std::string> : public boost::enable_sh
if(listener->message_completed(inbound_data_)) {
std::string receive_data(&inbound_data_[0], inbound_data_.size());
#ifdef EXTENDED_TRACE
LOG(TRACE) << "inbound async data with len " << inbound_data_.size() << ":'" << receive_data << "'";
CPPLOG(TRACE) << "inbound async data with len " << inbound_data_.size() << ":'" << receive_data << "'";
#endif
if(listener)
listener->receive_completed(e, &receive_data);
Expand Down Expand Up @@ -368,7 +368,7 @@ template <> class connection<std::string, std::string> : public boost::enable_sh
void write_data(const std::string& t, boost::system::error_code& ec) {
outbound_data_ = t;
#ifdef EXTENDED_TRACE
LOG(TRACE) << "outbound sync data with len " << outbound_data_.size() << ":'" << outbound_data_ << "'";
CPPLOG(TRACE) << "outbound sync data with len " << outbound_data_.size() << ":'" << outbound_data_ << "'";
#endif // Format the header.
// Write the serialized data to the socket. We use "gather-write" to send
// both the header and the data in a single write operation.
Expand Down
6 changes: 3 additions & 3 deletions src/iss/debugger/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ template <class SESSION> class server : public server_base {
public:
static void run_server(iss::debugger_if* vm, unsigned int port) {
if(get() != NULL) {
LOG(FATAL) << "server already initialized";
CPPLOG(FATAL) << "server already initialized";
}
LOG(DEBUG) << "starting server listening on port " << port;
CPPLOG(DEBUG) << "starting server listening on port " << port;
get(new server<SESSION>(vm, port));
}

Expand Down Expand Up @@ -114,7 +114,7 @@ template <class SESSION> class server : public server_base {
// An error occurred. Log it and return. Since we are not starting a new
// accept operation the io_service will run out of work to do and the
// thread will exit.
LOG(ERR) << e.message();
CPPLOG(ERR) << e.message();
}
}
// server related members
Expand Down
2 changes: 1 addition & 1 deletion src/iss/debugger/server_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void server_base::step(unsigned coreId, unsigned steps) {
syncronizer.enqueue_and_wait(&server_base::dummy_func, this);
while(!syncronizer.is_ready())
std::this_thread::sleep_for(std::chrono::milliseconds(10));
LOG(TRACE) << "step finished";
CPPLOG(TRACE) << "step finished";
}
// called from debugger
void server_base::run(unsigned coreId) {
Expand Down
8 changes: 4 additions & 4 deletions src/iss/interp/vm_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,23 @@ template <typename ARCH> class vm_base : public debugger_if, public vm_if {
sync_exec = PRE_SYNC;
auto start = std::chrono::high_resolution_clock::now();
virt_addr_t pc(iss::access_type::FETCH, arch::traits<ARCH>::MEM, get_reg<addr_t>(arch::traits<ARCH>::PC));
LOG(INFO) << "Start at 0x" << std::hex << pc.val << std::dec;
CPPLOG(INFO) << "Start at 0x" << std::hex << pc.val << std::dec;
try {
execute_inst(cond, pc, icount);
} catch(simulation_stopped& e) {
LOG(INFO) << "ISS execution stopped with status 0x" << std::hex << e.state << std::dec;
CPPLOG(INFO) << "ISS execution stopped with status 0x" << std::hex << e.state << std::dec;
if(e.state != 1)
error = e.state;
} catch(decoding_error& e) {
LOG(ERR) << "ISS execution aborted at address 0x" << std::hex << e.addr << std::dec;
CPPLOG(ERR) << "ISS execution aborted at address 0x" << std::hex << e.addr << std::dec;
error = -1;
}
auto end = std::chrono::high_resolution_clock::now(); // end measurement
// here
auto elapsed = end - start;
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
auto instr_if = core.get_instrumentation_if();
LOG(INFO) << "Executed " << instr_if->get_instr_count() << " instructions in " << instr_if->get_total_cycles() << " cycles during "
CPPLOG(INFO) << "Executed " << instr_if->get_instr_count() << " instructions in " << instr_if->get_total_cycles() << " cycles during "
<< millis << "ms resulting in " << (core.get_icount() * 0.001 / millis) << "MIPS";
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion src/iss/llvm/jit_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ LLVMContext& getContext() {
translation_block getPointerToFunction(unsigned cluster_id, uint64_t phys_addr, std::function<Function*(Module*)>& generator,
bool dumpEnabled) {
#ifndef NDEBUG
LOG(TRACE) << "Compiling and executing code for 0x" << std::hex << phys_addr << std::dec;
CPPLOG(TRACE) << "Compiling and executing code for 0x" << std::hex << phys_addr << std::dec;
#endif
static unsigned i = 0;
std::array<char, 32> s;
Expand Down
10 changes: 5 additions & 5 deletions src/iss/llvm/vm_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ template <typename ARCH> class vm_base : public debugger_if, public vm_if {
sync_exec = PRE_SYNC;
auto start = std::chrono::high_resolution_clock::now();
virt_addr_t pc(iss::access_type::DEBUG_FETCH, 0, get_reg<typename arch::traits<ARCH>::addr_t>(arch::traits<ARCH>::PC));
LOG(INFO) << "Start at 0x" << std::hex << pc.val << std::dec;
CPPLOG(INFO) << "Start at 0x" << std::hex << pc.val << std::dec;
try {
continuation_e cont = CONT;
// struct to minimize the type size of the closure below to allow SSO
Expand Down Expand Up @@ -183,22 +183,22 @@ template <typename ARCH> class vm_base : public debugger_if, public vm_if {
pc.val = core.enter_trap(ta.id, ta.addr, 0);
}
#ifndef NDEBUG
LOG(TRACE) << "continuing @0x" << std::hex << pc << std::dec;
CPPLOG(TRACE) << "continuing @0x" << std::hex << pc << std::dec;
#endif
}
} catch(simulation_stopped& e) {
LOG(INFO) << "ISS execution stopped with status 0x" << std::hex << e.state << std::dec;
CPPLOG(INFO) << "ISS execution stopped with status 0x" << std::hex << e.state << std::dec;
if(e.state != 1)
error = e.state;
} catch(decoding_error& e) {
LOG(ERR) << "ISS execution aborted at address 0x" << std::hex << e.addr << std::dec;
CPPLOG(ERR) << "ISS execution aborted at address 0x" << std::hex << e.addr << std::dec;
error = -1;
}
auto end = std::chrono::high_resolution_clock::now(); // end measurement
// here
auto elapsed = end - start;
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
LOG(INFO) << "Executed " << core.get_icount() << " instructions in " << func_map.size() << " code blocks during " << millis
CPPLOG(INFO) << "Executed " << core.get_icount() << " instructions in " << func_map.size() << " code blocks during " << millis
<< "ms resulting in " << (core.get_icount() * 0.001 / millis) << "MIPS";
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion src/iss/plugin/caculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ struct error_handler_ {
template <typename, typename, typename> struct result { typedef void type; };

template <typename Iterator> void operator()(qi::info const& what, Iterator err_pos, Iterator last) const {
LOG(ERR) << "Expecting " << what // what failed?
CPPLOG(ERR) << "Expecting " << what // what failed?
<< " here: \"" << std::string(err_pos, last) // iterators to error-pos, end
<< "\"" << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion src/iss/tcc/jit_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace tcc {

translation_block getPointerToFunction(unsigned cluster_id, uint64_t phys_addr, gen_func& generator, bool dumpEnabled) {
#ifndef NDEBUG
LOG(TRACE) << "Compiling and executing code for 0x" << std::hex << phys_addr << std::dec;
CPPLOG(TRACE) << "Compiling and executing code for 0x" << std::hex << phys_addr << std::dec;
#endif
static unsigned i = 0;
auto res = generator();
Expand Down
12 changes: 6 additions & 6 deletions src/iss/tcc/vm_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ template <typename ARCH> class vm_base : public debugger_if, public vm_if {
sync_exec = PRE_SYNC;
auto start = std::chrono::high_resolution_clock::now();
virt_addr_t pc(iss::access_type::DEBUG_FETCH, 0, get_reg<typename arch::traits<ARCH>::addr_t>(arch::traits<ARCH>::PC));
LOG(INFO) << "Start at 0x" << std::hex << pc.val << std::dec;
CPPLOG(INFO) << "Start at 0x" << std::hex << pc.val << std::dec;
try {
continuation_e cont = CONT;
// struct to minimize the type size of the closure below to allow SSO
Expand Down Expand Up @@ -173,24 +173,24 @@ template <typename ARCH> class vm_base : public debugger_if, public vm_if {
pc.val = core.enter_trap(ta.id, ta.addr, 0);
}
#ifndef NDEBUG
LOG(TRACE) << "continuing @0x" << std::hex << pc << std::dec;
CPPLOG(TRACE) << "continuing @0x" << std::hex << pc << std::dec;
#endif
}
LOG(INFO) << "ISS execution finished";
CPPLOG(INFO) << "ISS execution finished";
error = core.stop_code() > 1 ? core.stop_code() : 0;
} catch(simulation_stopped& e) {
LOG(INFO) << "ISS execution stopped with status 0x" << std::hex << e.state << std::dec;
CPPLOG(INFO) << "ISS execution stopped with status 0x" << std::hex << e.state << std::dec;
if(e.state != 1)
error = e.state;
} catch(decoding_error& e) {
LOG(ERR) << "ISS execution aborted at address 0x" << std::hex << e.addr << std::dec;
CPPLOG(ERR) << "ISS execution aborted at address 0x" << std::hex << e.addr << std::dec;
error = -1;
}
auto end = std::chrono::high_resolution_clock::now(); // end measurement
// here
auto elapsed = end - start;
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
LOG(INFO) << "Executed " << core.get_icount() << " instructions in " << func_map.size() << " code blocks during " << millis
CPPLOG(INFO) << "Executed " << core.get_icount() << " instructions in " << func_map.size() << " code blocks during " << millis
<< "ms resulting in " << (core.get_icount() * 0.001 / millis) << "MIPS";
return error;
}
Expand Down
4 changes: 2 additions & 2 deletions src/iss/vm_jit_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ uint8_t read_mem(arch_if_ptr_t iface, uint32_t addr_type, uint32_t space, uint64

uint8_t write_mem(arch_if_ptr_t iface, uint32_t addr_type, uint32_t space, uint64_t addr, uint32_t length, uint8_t* data) {
#ifdef EXEC_LOGGING
LOG(TRACE) << "EXEC: write mem " << (unsigned)type << " of core " << iface << " at addr 0x" << hex << addr << " with value 0x" << data
CPPLOG(TRACE) << "EXEC: write mem " << (unsigned)type << " of core " << iface << " at addr 0x" << hex << addr << " with value 0x" << data
<< dec << " of len " << length;
#endif
return iface->write((address_type)addr_type, access_type::WRITE, (uint16_t)space, addr, length, data);
Expand All @@ -82,7 +82,7 @@ uint64_t leave_trap(void* iface, uint64_t flags) { return reinterpret_cast<arch_

void wait(void* iface, uint64_t flags) { reinterpret_cast<arch_if_ptr_t>(iface)->wait_until(flags); }

void print_string(void* iface, char* str) { LOG(DEBUG) << "[EXEC] " << str; }
void print_string(void* iface, char* str) { CPPLOG(DEBUG) << "[EXEC] " << str; }

void print_disass(void* iface, uint64_t pc, char* str) { reinterpret_cast<arch_if_ptr_t>(iface)->disass_output(pc, str); }

Expand Down

0 comments on commit 9423dbb

Please sign in to comment.