diff options
author | lloyd <[email protected]> | 2009-12-27 01:38:02 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-12-27 01:38:02 +0000 |
commit | 93eda35a7680421844bab8942b310237fc09d99d (patch) | |
tree | a2d29732d5dfd225ad104af141691f1795a3ec0f /src/utils | |
parent | 3278adc183efac99ae2779069ce1badae77982c1 (diff) |
Add debug.h which is an internal-only header with debug functions that
I tend to rewrite often in particular files while debugging things.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/debug.cpp | 35 | ||||
-rw-r--r-- | src/utils/debug.h | 29 | ||||
-rw-r--r-- | src/utils/info.txt | 1 |
3 files changed, 65 insertions, 0 deletions
diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp new file mode 100644 index 000000000..6ba1924ee --- /dev/null +++ b/src/utils/debug.cpp @@ -0,0 +1,35 @@ +/** +* Internal-use debugging functions for Botan +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/internal/debug.h> +#include <cstdio> + +namespace Botan { + +namespace Debug { + +void print_vec(const std::string& name, + const byte array[], + size_t array_len) + { + std::printf("%s = ", name.c_str()); + for(size_t i = 0; i != array_len; ++i) + std::printf("%02X", array[i]); + std::printf("\n"); + } + +void print_vec(const std::string& name, + const MemoryRegion<byte>& vec) + { + print_vec(name, &vec[0], vec.size()); + } + +} + +} + +#endif diff --git a/src/utils/debug.h b/src/utils/debug.h new file mode 100644 index 000000000..ee93d5ea0 --- /dev/null +++ b/src/utils/debug.h @@ -0,0 +1,29 @@ +/** +* Internal-use debugging functions for Botan +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_DEBUG_H__ +#define BOTAN_DEBUG_H__ + +#include <botan/secmem.h> + +namespace Botan { + +namespace Debug { + +void print_vec(const std::string& name, + const byte array[], + size_t array_len); + +void print_vec(const std::string& name, + const MemoryRegion<byte>& vec); + + +} + +} + +#endif diff --git a/src/utils/info.txt b/src/utils/info.txt index 93ece2e78..c71e2af84 100644 --- a/src/utils/info.txt +++ b/src/utils/info.txt @@ -15,6 +15,7 @@ version.cpp <header:internal> bit_ops.h +debug.h mlock.h prefetch.h rounding.h |