Additionally, this patch moves actual path definition to one place.
Change-Id: I984ac2c67d8a22ed749f2b1945a1cef237b88ace
+CONFIGURE_FILE(tizen-debug-on.service.in tizen-debug-on.service @ONLY)
+CONFIGURE_FILE(tizen-debug-off.service.in tizen-debug-off.service @ONLY)
+
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tizen-debug-on.service DESTINATION /usr/lib/systemd/system
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+++ /dev/null
-[Unit]
-Description=tizen debug off
-DefaultDependencies=no
-After=opt.mount tizen-debug-on.service
-Before=sysinit.target
-
-[Service]
-SmackProcessLabel=System
-Type=oneshot
-RemainAfterExit=yes
-ExecStart=/bin/rm -f /opt/etc/.debugmode
-ExecStart=/sbin/sysctl kernel.core_pattern=/dev/null
-
-[Install]
-WantedBy=sysinit.target
--- /dev/null
+[Unit]
+Description=tizen debug off
+DefaultDependencies=no
+After=opt.mount tizen-debug-on.service
+Before=sysinit.target
+
+[Service]
+SmackProcessLabel=System
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/rm -f @DEBUGMODE_PATH@
+
+[Install]
+WantedBy=sysinit.target
+++ /dev/null
-[Unit]
-Description=tizen debug on
-DefaultDependencies=no
-After=opt.mount
-Before=sysinit.target
-
-[Service]
-SmackProcessLabel=System
-Type=oneshot
-RemainAfterExit=yes
-ExecStart=/bin/touch -f /opt/etc/.debugmode
-ExecStart=/sbin/sysctl -p /usr/lib/sysctl.d/99-crash-manager.conf
-
-[Install]
-WantedBy=sysinit.target
--- /dev/null
+[Unit]
+Description=tizen debug on
+DefaultDependencies=no
+After=opt.mount
+Before=sysinit.target
+
+[Service]
+SmackProcessLabel=System
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/touch -f @DEBUGMODE_PATH@
+
+[Install]
+WantedBy=sysinit.target
%define _with_tests on
%define TIZEN_FEATURE_PTRACE_CALLSTACK on
%bcond_with doc
-%bcond_with core_dump
%bcond_with sys_assert
%bcond_with tests
%define crash_path %{TZ_SYS_CRASH}
%define crash_temp %{crash_root_path}/temp
+#Debug mode path - existence of file at path below mean that core file should be generated
+%define debugmode_path %{TZ_SYS_ETC}/.debugmode
+
#Path for log_dump module
%define crash_all_log %{TZ_SYS_ALLLOGS}
%define crash_dump_gen %{TZ_SYS_DUMPGEN}
-DCRASH_ROOT_PATH=%{crash_root_path} \
-DCRASH_PATH=%{crash_path} \
-DCRASH_TEMP=%{crash_temp} \
+ -DDEBUGMODE_PATH=%{debugmode_path} \
-DCRASH_PIPE_PATH=%{_libexecdir}/crash-pipe \
%if "%{TIZEN_FEATURE_PTRACE_CALLSTACK}" == "on"
-DCRASH_STACK_PATH=%{_libexecdir}/crash-stack \
-DCRASH_TESTS_PATH=%{_libdir}/crash-worker-tests \
-DSYS_ASSERT=%{on_off sys_assert} \
-DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
- -DWITH_CORE_DUMP=%{on_off core_dump} \
-DTIZEN_FEATURE_PTRACE_CALLSTACK=%{TIZEN_FEATURE_PTRACE_CALLSTACK}
make %{?jobs:-j%jobs}
#undef LOG_TAG
#define LOG_TAG "CRASH_MANAGER"
-#define DEBUGMODE_FILE tzplatform_mkpath(TZ_SYS_ETC, ".debugmode")
-
/* Parsing */
#define CRASH_CONF_FILE tzplatform_mkpath(TZ_SYS_ETC, "crash-manager.conf")
#define KEY_MAX 255
{
/* Execute dump_systemstate in parallel */
static int dump_state_pid;
+ int debug_mode = access(DEBUGMODE_PATH, F_OK) == 0;
prctl(PR_SET_DUMPABLE, 0);
dump_state_pid = dump_system_state();
/* Exec crash modules */
- execute_crash_modules(argc, argv, DEBUG);
+ execute_crash_modules(argc, argv, debug_mode);
/* Wait dump_system_state */
wait_system_command(dump_state_pid);
else
move_dump_dir();
- /* .dbugmode: launch crash-popup */
- if (access(DEBUGMODE_FILE, F_OK) == 0)
+ /* launch crash-popup only if core file was saved ("debug mode")*/
+ if (debug_mode)
launch_crash_popup();
return 0;
#define CRASH_STACK_PATH "@CRASH_STACK_PATH@"
#endif
#define CRASH_PIPE_PATH "@CRASH_PIPE_PATH@"
-
-#define DEBUG 1
+#define DEBUGMODE_PATH "@DEBUGMODE_PATH@"
#endif