Loading cmds/dumpstate/dumpstate.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ int control_socket_fd = -1; /* suffix of the bugreport files - it's typically the date (when invoked with -d), * although it could be changed by the user using a system property */ static std::string suffix; static bool dry_run = false; #define PSTORE_LAST_KMSG "/sys/fs/pstore/console-ramoops" #define ALT_PSTORE_LAST_KMSG "/sys/fs/pstore/console-ramoops-0" Loading Loading @@ -95,7 +96,7 @@ std::string bugreport_dir; /* * List of supported zip format versions. * * See bugreport-format.txt for more info. * See bugreport-format.md for more info. */ static std::string VERSION_DEFAULT = "1.0"; Loading @@ -103,6 +104,10 @@ bool is_user_build() { return 0 == strncmp(build_type, "user", PROPERTY_VALUE_MAX - 1); } bool is_dry_run() { return dry_run; } /* gets the tombstone data, according to the bugreport type: if zipped, gets all tombstones; * otherwise, gets just those modified in the last half an hour. */ static void get_tombstone_fds(tombstone_data_t data[NUM_TOMBSTONES]) { Loading Loading @@ -1161,6 +1166,11 @@ int main(int argc, char *argv[]) { MYLOGI("begin\n"); dry_run = property_get_bool("dumpstate.dry_run", 0) != 0; if (is_dry_run()) { MYLOGI("Running on dry-run mode (to disable it, call 'setprop dumpstate.dry_run false')\n"); } /* gets the sequential id */ char last_id[PROPERTY_VALUE_MAX]; property_get("dumpstate.last_id", last_id, "0"); Loading cmds/dumpstate/dumpstate.h +19 −14 Original line number Diff line number Diff line Loading @@ -14,19 +14,15 @@ * limitations under the License. */ #ifndef _DUMPSTATE_H_ #define _DUMPSTATE_H_ /* When defined, skips the real dumps and just print the section headers. Useful when debugging dumpstate itself. */ //#define _DUMPSTATE_DRY_RUN_ #ifdef _DUMPSTATE_DRY_RUN_ #define ON_DRY_RUN_RETURN(X) return X #define ON_DRY_RUN(code) code #else #define ON_DRY_RUN_RETURN(X) #define ON_DRY_RUN(code) #ifndef FRAMEWORK_NATIVE_CMD_DUMPSTATE_H_ #define FRAMEWORK_NATIVE_CMD_DUMPSTATE_H_ #ifndef ON_DRY_RUN_RETURN #define ON_DRY_RUN_RETURN(X) if (is_dry_run()) return X #endif #ifndef ON_DRY_RUN #define ON_DRY_RUN(code) if (is_dry_run()) code #endif #ifndef MYLOGD Loading Loading @@ -211,6 +207,15 @@ void format_args(int argc, const char *argv[], std::string *args); /** Tells if the device is running a user build. */ bool is_user_build(); /* * When running in dry-run mode, skips the real dumps and just print the section headers. * * Useful when debugging dumpstate or other bugreport-related activities. * * Dry-run mode is enabled by setting the system property dumpstate.dry_run to true. */ bool is_dry_run(); /* * Helper class used to report how long it takes for a section to finish. * Loading Loading @@ -238,4 +243,4 @@ private: } #endif #endif /* _DUMPSTATE_H_ */ #endif /* FRAMEWORK_NATIVE_CMD_DUMPSTATE_H_ */ Loading
cmds/dumpstate/dumpstate.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ int control_socket_fd = -1; /* suffix of the bugreport files - it's typically the date (when invoked with -d), * although it could be changed by the user using a system property */ static std::string suffix; static bool dry_run = false; #define PSTORE_LAST_KMSG "/sys/fs/pstore/console-ramoops" #define ALT_PSTORE_LAST_KMSG "/sys/fs/pstore/console-ramoops-0" Loading Loading @@ -95,7 +96,7 @@ std::string bugreport_dir; /* * List of supported zip format versions. * * See bugreport-format.txt for more info. * See bugreport-format.md for more info. */ static std::string VERSION_DEFAULT = "1.0"; Loading @@ -103,6 +104,10 @@ bool is_user_build() { return 0 == strncmp(build_type, "user", PROPERTY_VALUE_MAX - 1); } bool is_dry_run() { return dry_run; } /* gets the tombstone data, according to the bugreport type: if zipped, gets all tombstones; * otherwise, gets just those modified in the last half an hour. */ static void get_tombstone_fds(tombstone_data_t data[NUM_TOMBSTONES]) { Loading Loading @@ -1161,6 +1166,11 @@ int main(int argc, char *argv[]) { MYLOGI("begin\n"); dry_run = property_get_bool("dumpstate.dry_run", 0) != 0; if (is_dry_run()) { MYLOGI("Running on dry-run mode (to disable it, call 'setprop dumpstate.dry_run false')\n"); } /* gets the sequential id */ char last_id[PROPERTY_VALUE_MAX]; property_get("dumpstate.last_id", last_id, "0"); Loading
cmds/dumpstate/dumpstate.h +19 −14 Original line number Diff line number Diff line Loading @@ -14,19 +14,15 @@ * limitations under the License. */ #ifndef _DUMPSTATE_H_ #define _DUMPSTATE_H_ /* When defined, skips the real dumps and just print the section headers. Useful when debugging dumpstate itself. */ //#define _DUMPSTATE_DRY_RUN_ #ifdef _DUMPSTATE_DRY_RUN_ #define ON_DRY_RUN_RETURN(X) return X #define ON_DRY_RUN(code) code #else #define ON_DRY_RUN_RETURN(X) #define ON_DRY_RUN(code) #ifndef FRAMEWORK_NATIVE_CMD_DUMPSTATE_H_ #define FRAMEWORK_NATIVE_CMD_DUMPSTATE_H_ #ifndef ON_DRY_RUN_RETURN #define ON_DRY_RUN_RETURN(X) if (is_dry_run()) return X #endif #ifndef ON_DRY_RUN #define ON_DRY_RUN(code) if (is_dry_run()) code #endif #ifndef MYLOGD Loading Loading @@ -211,6 +207,15 @@ void format_args(int argc, const char *argv[], std::string *args); /** Tells if the device is running a user build. */ bool is_user_build(); /* * When running in dry-run mode, skips the real dumps and just print the section headers. * * Useful when debugging dumpstate or other bugreport-related activities. * * Dry-run mode is enabled by setting the system property dumpstate.dry_run to true. */ bool is_dry_run(); /* * Helper class used to report how long it takes for a section to finish. * Loading Loading @@ -238,4 +243,4 @@ private: } #endif #endif /* _DUMPSTATE_H_ */ #endif /* FRAMEWORK_NATIVE_CMD_DUMPSTATE_H_ */