Point to online documentation.
Test: Unit tests pass.
Change-Id: Ibbdc260bfdf6a6daf091c4a49cdf03e51f6ca6cf
diff --git a/libc/malloc_debug/Config.cpp b/libc/malloc_debug/Config.cpp
index 96fc27f..926b265 100644
--- a/libc/malloc_debug/Config.cpp
+++ b/libc/malloc_debug/Config.cpp
@@ -319,120 +319,8 @@
}
void Config::LogUsage() const {
- error_log("malloc debug options usage:");
- error_log("");
- error_log(" front_guard[=XX]");
- error_log(" Enables a front guard on all allocations. If XX is set");
- error_log(" it sets the number of bytes in the guard. The default is");
- error_log(" %zu bytes, the max bytes is %zu.", DEFAULT_GUARD_BYTES, MAX_GUARD_BYTES);
- error_log("");
- error_log(" rear_guard[=XX]");
- error_log(" Enables a rear guard on all allocations. If XX is set");
- error_log(" it sets the number of bytes in the guard. The default is");
- error_log(" %zu bytes, the max bytes is %zu.", DEFAULT_GUARD_BYTES, MAX_GUARD_BYTES);
- error_log("");
- error_log(" guard[=XX]");
- error_log(" Enables both a front guard and a rear guard on all allocations.");
- error_log(" If XX is set it sets the number of bytes in both guards.");
- error_log(" The default is %zu bytes, the max bytes is %zu.", DEFAULT_GUARD_BYTES,
- MAX_GUARD_BYTES);
- error_log("");
- error_log(" backtrace[=XX]");
- error_log(" Enable capturing the backtrace at the point of allocation.");
- error_log(" If XX is set it sets the number of backtrace frames.");
- error_log(" This option also enables dumping the backtrace heap data");
- error_log(" when a signal is received. The data is dumped to the file");
- error_log(" backtrace_dump_prefix.<PID>.txt.");
- error_log(" The default is %zu frames, the max number of frames is %zu.",
- DEFAULT_BACKTRACE_FRAMES, MAX_BACKTRACE_FRAMES);
- error_log("");
- error_log(" backtrace_enable_on_signal[=XX]");
- error_log(" Enable capturing the backtrace at the point of allocation.");
- error_log(" The backtrace capture is not enabled until the process");
- error_log(" receives a signal. If XX is set it sets the number of backtrace");
- error_log(" frames. The default is %zu frames, the max number of frames is %zu.",
- DEFAULT_BACKTRACE_FRAMES, MAX_BACKTRACE_FRAMES);
- error_log("");
- error_log(" backtrace_dump_prefix[=FILE]");
- error_log(" This option only has meaning if the backtrace option has been specified.");
- error_log(" This is the prefix of the name of the file to which backtrace heap");
- error_log(" data will be dumped. The file will be named backtrace_dump_prefix.<PID>.txt.");
- error_log(" The default is %s.", DEFAULT_BACKTRACE_DUMP_PREFIX);
-
- error_log("");
- error_log(" backtrace_dump_on_exit");
- error_log(" This option only has meaning if the backtrace option has been specified.");
- error_log(" This will cause all live allocations to be dumped to the file");
- error_log(" backtrace_dump_prefix.<PID>.final.txt.");
- error_log(" The default is false.");
- error_log("");
- error_log(" backtrace_full");
- error_log(" Any time a backtrace is acquired, use an unwinder that can");
- error_log(" display Java stack frames. This unwinder can run slower than");
- error_log(" normal unwinder.");
- error_log("");
- error_log(" fill_on_alloc[=XX]");
- error_log(" On first allocation, fill with the value 0x%02x.", DEFAULT_FILL_ALLOC_VALUE);
- error_log(" If XX is set it will only fill up to XX bytes of the");
- error_log(" allocation. The default is to fill the entire allocation.");
- error_log("");
- error_log(" fill_on_free[=XX]");
- error_log(" On free, fill with the value 0x%02x. If XX is set it will",
- DEFAULT_FILL_FREE_VALUE);
- error_log(" only fill up to XX bytes of the allocation. The default is to");
- error_log(" fill the entire allocation.");
- error_log("");
- error_log(" fill[=XX]");
- error_log(" On both first allocation free, fill with the value 0x%02x on",
- DEFAULT_FILL_ALLOC_VALUE);
- error_log(" first allocation and the value 0x%02x. If XX is set, only fill",
- DEFAULT_FILL_FREE_VALUE);
- error_log(" up to XX bytes. The default is to fill the entire allocation.");
- error_log("");
- error_log(" expand_alloc[=XX]");
- error_log(" Allocate an extra number of bytes for every allocation call.");
- error_log(" If XX is set, that is the number of bytes to expand the");
- error_log(" allocation by. The default is %zu bytes, the max bytes is %zu.",
- DEFAULT_EXPAND_BYTES, MAX_EXPAND_BYTES);
- error_log("");
- error_log(" free_track[=XX]");
- error_log(" When a pointer is freed, do not free the memory right away.");
- error_log(" Instead, keep XX of these allocations around and then verify");
- error_log(" that they have not been modified when the total number of freed");
- error_log(" allocations exceeds the XX amount. When the program terminates,");
- error_log(" the rest of these allocations are verified. When this option is");
- error_log(" enabled, it automatically records the backtrace at the time of the free.");
- error_log(" The default is to record %zu allocations, the max allocations",
- DEFAULT_FREE_TRACK_ALLOCATIONS);
- error_log(" to record is %zu.", MAX_FREE_TRACK_ALLOCATIONS);
- error_log("");
- error_log(" free_track_backtrace_num_frames[=XX]");
- error_log(" This option only has meaning if free_track is set. This indicates");
- error_log(" how many backtrace frames to capture when an allocation is freed.");
- error_log(" If XX is set, that is the number of frames to capture. If XX");
- error_log(" is set to zero, then no backtrace will be captured.");
- error_log(" The default is to record %zu frames, the max number of frames is %zu.",
- DEFAULT_BACKTRACE_FRAMES, MAX_BACKTRACE_FRAMES);
- error_log("");
- error_log(" leak_track");
- error_log(" Enable the leak tracking of memory allocations.");
- error_log("");
- error_log(" record_allocs[=XX]");
- error_log(" Record every single allocation/free call. When a specific signal");
- error_log(" is sent to the process, the contents of recording are written to");
- error_log(" a file (%s) and the recording is cleared.", DEFAULT_RECORD_ALLOCS_FILE);
- error_log(" If XX is set, that is the total number of allocations/frees that can");
- error_log(" recorded. of frames to capture. The default value is %zu.", DEFAULT_RECORD_ALLOCS);
- error_log(" If the allocation list fills up, all further allocations are not recorded.");
- error_log("");
- error_log(" record_allocs_file[=FILE]");
- error_log(" This option only has meaning if the record_allocs options has been specified.");
- error_log(" This is the name of the file to which recording information will be dumped.");
- error_log(" The default is %s.", DEFAULT_RECORD_ALLOCS_FILE);
- error_log("");
- error_log(" verify_pointers");
- error_log(" A lightweight way to verify that free/malloc_usable_size/realloc");
- error_log(" are passed valid pointers.");
+ error_log("For malloc debug option descriptions go to:");
+ error_log(" https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md");
}
bool Config::GetOption(const char** options_str, std::string* option, std::string* value) {
diff --git a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
index 2a6e399..a083b4f 100644
--- a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
@@ -40,111 +40,8 @@
};
std::string usage_string(
- "6 malloc_debug malloc debug options usage:\n"
- "6 malloc_debug \n"
- "6 malloc_debug front_guard[=XX]\n"
- "6 malloc_debug Enables a front guard on all allocations. If XX is set\n"
- "6 malloc_debug it sets the number of bytes in the guard. The default is\n"
- "6 malloc_debug 32 bytes, the max bytes is 16384.\n"
- "6 malloc_debug \n"
- "6 malloc_debug rear_guard[=XX]\n"
- "6 malloc_debug Enables a rear guard on all allocations. If XX is set\n"
- "6 malloc_debug it sets the number of bytes in the guard. The default is\n"
- "6 malloc_debug 32 bytes, the max bytes is 16384.\n"
- "6 malloc_debug \n"
- "6 malloc_debug guard[=XX]\n"
- "6 malloc_debug Enables both a front guard and a rear guard on all allocations.\n"
- "6 malloc_debug If XX is set it sets the number of bytes in both guards.\n"
- "6 malloc_debug The default is 32 bytes, the max bytes is 16384.\n"
- "6 malloc_debug \n"
- "6 malloc_debug backtrace[=XX]\n"
- "6 malloc_debug Enable capturing the backtrace at the point of allocation.\n"
- "6 malloc_debug If XX is set it sets the number of backtrace frames.\n"
- "6 malloc_debug This option also enables dumping the backtrace heap data\n"
- "6 malloc_debug when a signal is received. The data is dumped to the file\n"
- "6 malloc_debug backtrace_dump_prefix.<PID>.txt.\n"
- "6 malloc_debug The default is 16 frames, the max number of frames is 256.\n"
- "6 malloc_debug \n"
- "6 malloc_debug backtrace_enable_on_signal[=XX]\n"
- "6 malloc_debug Enable capturing the backtrace at the point of allocation.\n"
- "6 malloc_debug The backtrace capture is not enabled until the process\n"
- "6 malloc_debug receives a signal. If XX is set it sets the number of backtrace\n"
- "6 malloc_debug frames. The default is 16 frames, the max number of frames is 256.\n"
- "6 malloc_debug \n"
- "6 malloc_debug backtrace_dump_prefix[=FILE]\n"
- "6 malloc_debug This option only has meaning if the backtrace option has been specified.\n"
- "6 malloc_debug This is the prefix of the name of the file to which backtrace heap\n"
- "6 malloc_debug data will be dumped. The file will be named backtrace_dump_prefix.<PID>.txt.\n"
- "6 malloc_debug The default is /data/local/tmp/backtrace_heap.\n"
- "6 malloc_debug \n"
- "6 malloc_debug backtrace_dump_on_exit\n"
- "6 malloc_debug This option only has meaning if the backtrace option has been specified.\n"
- "6 malloc_debug This will cause all live allocations to be dumped to the file\n"
- "6 malloc_debug backtrace_dump_prefix.<PID>.final.txt.\n"
- "6 malloc_debug The default is false.\n"
- "6 malloc_debug \n"
- "6 malloc_debug backtrace_full\n"
- "6 malloc_debug Any time a backtrace is acquired, use an unwinder that can\n"
- "6 malloc_debug display Java stack frames. This unwinder can run slower than\n"
- "6 malloc_debug normal unwinder.\n"
- "6 malloc_debug \n"
- "6 malloc_debug fill_on_alloc[=XX]\n"
- "6 malloc_debug On first allocation, fill with the value 0xeb.\n"
- "6 malloc_debug If XX is set it will only fill up to XX bytes of the\n"
- "6 malloc_debug allocation. The default is to fill the entire allocation.\n"
- "6 malloc_debug \n"
- "6 malloc_debug fill_on_free[=XX]\n"
- "6 malloc_debug On free, fill with the value 0xef. If XX is set it will\n"
- "6 malloc_debug only fill up to XX bytes of the allocation. The default is to\n"
- "6 malloc_debug fill the entire allocation.\n"
- "6 malloc_debug \n"
- "6 malloc_debug fill[=XX]\n"
- "6 malloc_debug On both first allocation free, fill with the value 0xeb on\n"
- "6 malloc_debug first allocation and the value 0xef. If XX is set, only fill\n"
- "6 malloc_debug up to XX bytes. The default is to fill the entire allocation.\n"
- "6 malloc_debug \n"
- "6 malloc_debug expand_alloc[=XX]\n"
- "6 malloc_debug Allocate an extra number of bytes for every allocation call.\n"
- "6 malloc_debug If XX is set, that is the number of bytes to expand the\n"
- "6 malloc_debug allocation by. The default is 16 bytes, the max bytes is 16384.\n"
- "6 malloc_debug \n"
- "6 malloc_debug free_track[=XX]\n"
- "6 malloc_debug When a pointer is freed, do not free the memory right away.\n"
- "6 malloc_debug Instead, keep XX of these allocations around and then verify\n"
- "6 malloc_debug that they have not been modified when the total number of freed\n"
- "6 malloc_debug allocations exceeds the XX amount. When the program terminates,\n"
- "6 malloc_debug the rest of these allocations are verified. When this option is\n"
- "6 malloc_debug enabled, it automatically records the backtrace at the time of the free.\n"
- "6 malloc_debug The default is to record 100 allocations, the max allocations\n"
- "6 malloc_debug to record is 16384.\n"
- "6 malloc_debug \n"
- "6 malloc_debug free_track_backtrace_num_frames[=XX]\n"
- "6 malloc_debug This option only has meaning if free_track is set. This indicates\n"
- "6 malloc_debug how many backtrace frames to capture when an allocation is freed.\n"
- "6 malloc_debug If XX is set, that is the number of frames to capture. If XX\n"
- "6 malloc_debug is set to zero, then no backtrace will be captured.\n"
- "6 malloc_debug The default is to record 16 frames, the max number of frames is 256.\n"
- "6 malloc_debug \n"
- "6 malloc_debug leak_track\n"
- "6 malloc_debug Enable the leak tracking of memory allocations.\n"
- "6 malloc_debug \n"
- "6 malloc_debug record_allocs[=XX]\n"
- "6 malloc_debug Record every single allocation/free call. When a specific signal\n"
- "6 malloc_debug is sent to the process, the contents of recording are written to\n"
- "6 malloc_debug a file (/data/local/tmp/record_allocs.txt) and the recording is cleared.\n"
- "6 malloc_debug If XX is set, that is the total number of allocations/frees that can\n"
- "6 malloc_debug recorded. of frames to capture. The default value is 8000000.\n"
- "6 malloc_debug If the allocation list fills up, all further allocations are not recorded.\n"
- "6 malloc_debug \n"
- "6 malloc_debug record_allocs_file[=FILE]\n"
- "6 malloc_debug This option only has meaning if the record_allocs options has been specified.\n"
- "6 malloc_debug This is the name of the file to which recording information will be dumped.\n"
- "6 malloc_debug The default is /data/local/tmp/record_allocs.txt.\n"
- "6 malloc_debug \n"
- "6 malloc_debug verify_pointers\n"
- "6 malloc_debug A lightweight way to verify that free/malloc_usable_size/realloc\n"
- "6 malloc_debug are passed valid pointers.\n"
-);
+ "6 malloc_debug For malloc debug option descriptions go to:\n"
+ "6 malloc_debug https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md\n");
TEST_F(MallocDebugConfigTest, unknown_option) {