From 5762bedab3a671ddfd279737d370533f31ed979e Mon Sep 17 00:00:00 2001 From: Scott Beamer Date: Tue, 13 Sep 2016 13:42:05 -0700 Subject: [PATCH] restore clang support by fixing printf identifiers --- riscv/debug_module.cc | 12 ++++++------ riscv/gdbserver.cc | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/riscv/debug_module.cc b/riscv/debug_module.cc index 8ad9513..17b8b45 100644 --- a/riscv/debug_module.cc +++ b/riscv/debug_module.cc @@ -19,8 +19,8 @@ bool debug_module_t::load(reg_t addr, size_t len, uint8_t* bytes) return true; } - fprintf(stderr, "ERROR: invalid load from debug module: %ld bytes at 0x%lx\n", - len, addr); + fprintf(stderr, "ERROR: invalid load from debug module: %ld bytes at 0x%016" + PRIx64 "\n", len, addr); return false; } @@ -29,8 +29,8 @@ bool debug_module_t::store(reg_t addr, size_t len, const uint8_t* bytes) addr = DEBUG_START + addr; if (addr & (len-1)) { - fprintf(stderr, "ERROR: unaligned store to debug module: %ld bytes at 0x%lx\n", - len, addr); + fprintf(stderr, "ERROR: unaligned store to debug module: %ld bytes at 0x%016" + PRIx64 "\n", len, addr); return false; } @@ -47,8 +47,8 @@ bool debug_module_t::store(reg_t addr, size_t len, const uint8_t* bytes) return true; } - fprintf(stderr, "ERROR: invalid store to debug module: %ld bytes at 0x%lx\n", - len, addr); + fprintf(stderr, "ERROR: invalid store to debug module: %ld bytes at 0x%016" + PRIx64 "\n", len, addr); return false; } diff --git a/riscv/gdbserver.cc b/riscv/gdbserver.cc index 481e5b9..f9e335b 100644 --- a/riscv/gdbserver.cc +++ b/riscv/gdbserver.cc @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -848,8 +849,9 @@ class memory_write_op_t : public operation_t (data[6] << 16) | (data[7] << 24)); break; default: - fprintf(stderr, "gdbserver error: write %d bytes to 0x%lx -> 0x%lx; " - "access_size=%d\n", length, vaddr, paddr, access_size); + fprintf(stderr, "gdbserver error: write %d bytes to 0x%016" PRIx64 + " -> 0x%016" PRIx64 "; access_size=%d\n", + length, vaddr, paddr, access_size); gs.send_packet("E12"); return true; } @@ -861,8 +863,8 @@ class memory_write_op_t : public operation_t } if (gs.dr_read32(DEBUG_RAM_SIZE / 4 - 1)) { - fprintf(stderr, "Exception happened while writing to 0x%lx -> 0x%lx\n", - vaddr, paddr); + fprintf(stderr, "Exception happened while writing to 0x%016" PRIx64 + " -> 0x%016" PRIx64 "\n", vaddr, paddr); } offset += access_size; @@ -1019,7 +1021,7 @@ class collect_translation_info_op_t : public operation_t } } fprintf(stderr, - "ERROR: gdbserver couldn't find appropriate PTEs to translate 0x%lx\n", + "ERROR: gdbserver couldn't find appropriate PTEs to translate 0x%016" PRIx64 "\n", vaddr); return true; } @@ -1306,8 +1308,8 @@ reg_t gdbserver_t::translate(reg_t vaddr) reg_t pte_addr = base + idx * ptesize; auto it = pte_cache.find(pte_addr); if (it == pte_cache.end()) { - fprintf(stderr, "ERROR: gdbserver tried to translate 0x%lx without first " - "collecting the relevant PTEs.\n", vaddr); + fprintf(stderr, "ERROR: gdbserver tried to translate 0x%016" PRIx64 + " without first collecting the relevant PTEs.\n", vaddr); die("gdbserver_t::translate()"); } @@ -1326,8 +1328,8 @@ reg_t gdbserver_t::translate(reg_t vaddr) } } - fprintf(stderr, "ERROR: gdbserver tried to translate 0x%lx but the relevant " - "PTEs are invalid.\n", vaddr); + fprintf(stderr, "ERROR: gdbserver tried to translate 0x%016" PRIx64 + " but the relevant PTEs are invalid.\n", vaddr); // TODO: Is it better to throw an exception here? return -1; } -- 2.30.2