| OLD | NEW |
| 1 // Copyright (c) 2000, Google Inc. | 1 // Copyright (c) 2000, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include <sys/stat.h> | 61 #include <sys/stat.h> |
| 62 #include <sys/types.h> | 62 #include <sys/types.h> |
| 63 #ifdef HAVE_UNISTD_H | 63 #ifdef HAVE_UNISTD_H |
| 64 #include <unistd.h> | 64 #include <unistd.h> |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 #include <gperftools/malloc_extension.h> | 67 #include <gperftools/malloc_extension.h> |
| 68 #include <gperftools/malloc_hook.h> | 68 #include <gperftools/malloc_hook.h> |
| 69 #include <gperftools/stacktrace.h> | 69 #include <gperftools/stacktrace.h> |
| 70 #include "addressmap-inl.h" | 70 #include "addressmap-inl.h" |
| 71 #include "base/abort.h" |
| 71 #include "base/commandlineflags.h" | 72 #include "base/commandlineflags.h" |
| 72 #include "base/googleinit.h" | 73 #include "base/googleinit.h" |
| 73 #include "base/logging.h" | 74 #include "base/logging.h" |
| 74 #include "base/spinlock.h" | 75 #include "base/spinlock.h" |
| 75 #include "malloc_hook-inl.h" | 76 #include "malloc_hook-inl.h" |
| 76 #include "symbolize.h" | 77 #include "symbolize.h" |
| 77 | 78 |
| 78 #define TCMALLOC_USING_DEBUGALLOCATION | 79 #define TCMALLOC_USING_DEBUGALLOCATION |
| 79 #include "tcmalloc.cc" | 80 #include "tcmalloc.cc" |
| 80 | 81 |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 } else if (*p == 'd') { // %d | 883 } else if (*p == 'd') { // %d |
| 883 l = va_arg(ap, int); | 884 l = va_arg(ap, int); |
| 884 base = 10; | 885 base = 10; |
| 885 } else if (*p == 'p') { // %p | 886 } else if (*p == 'p') { // %p |
| 886 l = va_arg(ap, intptr_t); | 887 l = va_arg(ap, intptr_t); |
| 887 base = 16; | 888 base = 16; |
| 888 } else { | 889 } else { |
| 889 write(STDERR_FILENO, "Unimplemented TracePrintf format\n", 33); | 890 write(STDERR_FILENO, "Unimplemented TracePrintf format\n", 33); |
| 890 write(STDERR_FILENO, p, 2); | 891 write(STDERR_FILENO, p, 2); |
| 891 write(STDERR_FILENO, "\n", 1); | 892 write(STDERR_FILENO, "\n", 1); |
| 892 abort(); | 893 tcmalloc::Abort(); |
| 893 } | 894 } |
| 894 p++; | 895 p++; |
| 895 if (base != 0) { | 896 if (base != 0) { |
| 896 bool minus = (l < 0 && base == 10); | 897 bool minus = (l < 0 && base == 10); |
| 897 uint64 ul = minus? -l : l; | 898 uint64 ul = minus? -l : l; |
| 898 do { | 899 do { |
| 899 *--s = "0123456789abcdef"[ul % base]; | 900 *--s = "0123456789abcdef"[ul % base]; |
| 900 ul /= base; | 901 ul /= base; |
| 901 } while (ul != 0); | 902 } while (ul != 0); |
| 902 if (base == 16) { | 903 if (base == 16) { |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 | 1412 |
| 1412 #ifdef HAVE_STRUCT_MALLINFO | 1413 #ifdef HAVE_STRUCT_MALLINFO |
| 1413 extern "C" PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW { | 1414 extern "C" PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW { |
| 1414 return BASE_MALLINFO(); | 1415 return BASE_MALLINFO(); |
| 1415 } | 1416 } |
| 1416 #endif | 1417 #endif |
| 1417 | 1418 |
| 1418 extern "C" PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) __THROW { | 1419 extern "C" PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) __THROW { |
| 1419 return MallocExtension::instance()->GetAllocatedSize(ptr); | 1420 return MallocExtension::instance()->GetAllocatedSize(ptr); |
| 1420 } | 1421 } |
| OLD | NEW |