summaryrefslogtreecommitdiffstats
path: root/adb/transport.c
diff options
context:
space:
mode:
authorSpencer Low <CompareAndSwap@gmail.com>2015-01-25 16:57:16 -0800
committerSpencer Low <CompareAndSwap@gmail.com>2015-01-27 15:42:14 -0800
commit0de77ffec6b4096f334bd45f48a6210915c6d1af (patch)
tree28141a425e932cf0782032e331f1dd0cbe04f4cb /adb/transport.c
parente862350bb2eb3d3eda526da7f3b6d5c2dd40a445 (diff)
downloadsystem_core-0de77ffec6b4096f334bd45f48a6210915c6d1af.zip
system_core-0de77ffec6b4096f334bd45f48a6210915c6d1af.tar.gz
system_core-0de77ffec6b4096f334bd45f48a6210915c6d1af.tar.bz2
adb: tracing: don't make strings if runtime tracing is disabled
If tracing was not enabled (the ADB_TRACE environment variable was not set specially), writex() and readx() would still call dump_hex() which would construct hex tracing strings, which would be immediately discarded and not printed (because tracing is not enabled). The fix is to only call dump_hex() if ADB_TRACING evalutes to true, the same way that dump_packet() is only called if ADB_TRACING evaluates to true. Change-Id: I1651680da344389475ebdeea77ba1982960d5764 Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
Diffstat (limited to 'adb/transport.c')
-rw-r--r--adb/transport.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/adb/transport.c b/adb/transport.c
index 7db6a47..ffe59da 100644
--- a/adb/transport.c
+++ b/adb/transport.c
@@ -1165,7 +1165,9 @@ int readx(int fd, void *ptr, size_t len)
#if ADB_TRACE
D("readx: fd=%d wanted=%zu got=%zu\n", fd, len0, len0 - len);
- dump_hex( ptr, len0 );
+ if (ADB_TRACING) {
+ dump_hex( ptr, len0 );
+ }
#endif
return 0;
}
@@ -1177,7 +1179,9 @@ int writex(int fd, const void *ptr, size_t len)
#if ADB_TRACE
D("writex: fd=%d len=%d: ", fd, (int)len);
- dump_hex( ptr, len );
+ if (ADB_TRACING) {
+ dump_hex( ptr, len );
+ }
#endif
while(len > 0) {
r = adb_write(fd, p, len);