summaryrefslogtreecommitdiffstats
path: root/common/debug.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-10-26 16:40:55 +0100
committerGravatar Martin Szulecki2014-10-26 16:40:55 +0100
commit1e86eab358edcd647b2d3544570e4f6988cc2aa5 (patch)
tree001359149c1d54804a90260deb29f6c761f7d7e7 /common/debug.c
parent9418c9957a4bd10c2a6fd19c7e38553fd51a59bf (diff)
downloadlibimobiledevice-1e86eab358edcd647b2d3544570e4f6988cc2aa5.tar.gz
libimobiledevice-1e86eab358edcd647b2d3544570e4f6988cc2aa5.tar.bz2
debug: Fix symbol locality for linker so debug messages are printed again
Diffstat (limited to 'common/debug.c')
-rw-r--r--common/debug.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/common/debug.c b/common/debug.c
index 8ad0f08..c4d3897 100644
--- a/common/debug.c
+++ b/common/debug.c
@@ -41,19 +41,6 @@
41 41
42#define MAX_PRINT_LEN 16*1024 42#define MAX_PRINT_LEN 16*1024
43 43
44int debug_level = 0;
45
46/**
47 * Sets the level of debugging. Currently the only acceptable values are 0 and
48 * 1.
49 *
50 * @param level Set to 0 for no debugging or 1 for debugging.
51 */
52LIBIMOBILEDEVICE_API void idevice_set_debug_level(int level)
53{
54 debug_level = level;
55}
56
57#ifndef STRIP_DEBUG_CODE 44#ifndef STRIP_DEBUG_CODE
58static void debug_print_line(const char *func, const char *file, int line, const char *buffer) 45static void debug_print_line(const char *func, const char *file, int line, const char *buffer)
59{ 46{
@@ -90,7 +77,7 @@ void debug_info_real(const char *func, const char *file, int line, const char *f
90 va_list args; 77 va_list args;
91 char *buffer = NULL; 78 char *buffer = NULL;
92 79
93 if (!debug_level) 80 if (!idevice_debug_level)
94 return; 81 return;
95 82
96 /* run the real fprintf */ 83 /* run the real fprintf */
@@ -111,7 +98,7 @@ void debug_buffer(const char *data, const int length)
111 int j; 98 int j;
112 unsigned char c; 99 unsigned char c;
113 100
114 if (debug_level) { 101 if (idevice_debug_level) {
115 for (i = 0; i < length; i += 16) { 102 for (i = 0; i < length; i += 16) {
116 fprintf(stderr, "%04x: ", i); 103 fprintf(stderr, "%04x: ", i);
117 for (j = 0; j < 16; j++) { 104 for (j = 0; j < 16; j++) {
@@ -142,7 +129,7 @@ void debug_buffer(const char *data, const int length)
142void debug_buffer_to_file(const char *file, const char *data, const int length) 129void debug_buffer_to_file(const char *file, const char *data, const int length)
143{ 130{
144#ifndef STRIP_DEBUG_CODE 131#ifndef STRIP_DEBUG_CODE
145 if (debug_level) { 132 if (idevice_debug_level) {
146 FILE *f = fopen(file, "wb"); 133 FILE *f = fopen(file, "wb");
147 fwrite(data, 1, length, f); 134 fwrite(data, 1, length, f);
148 fflush(f); 135 fflush(f);