Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
808274cb
Commit
808274cb
authored
Jul 24, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UniSetActivator): добавил возможность указать скрипт (или программу),
вызываемый при SIGSEGV или SIGABORT.
parent
fd8b5280
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
4 deletions
+26
-4
abort-script-example.sh
extensions/tests/SMemoryTest/abort-script-example.sh
+4
-0
start_fg.sh
extensions/tests/SMemoryTest/start_fg.sh
+1
-1
UniSetActivator.h
include/UniSetActivator.h
+8
-0
UniSetActivator.cc
src/ObjectRepository/UniSetActivator.cc
+13
-3
No files found.
extensions/tests/SMemoryTest/abort-script-example.sh
0 → 100755
View file @
808274cb
#!/bin/sh
gdb
--batch
-n
-ex
"thread apply all bt"
$1
$2
# | ssh xxxxxx
extensions/tests/SMemoryTest/start_fg.sh
View file @
808274cb
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
START
=
uniset2-start.sh
START
=
uniset2-start.sh
${
START
}
-f
./smemory-test
--confile
./test.xml
--dlog-add-levels
level1
--localNode
LocalhostNode
\
${
START
}
-f
./smemory-test
--confile
./test.xml
--dlog-add-levels
level1
--localNode
LocalhostNode
\
--sm-log-add-levels
any
$*
--sm-run-logserver
--TestProc1-run-logserver
--sm-log-add-levels
any
$*
--sm-run-logserver
--TestProc1-run-logserver
--uniset-abort-script
./abort-script-example.sh
#--ulog-add-levels crit,warn,info
#--ulog-add-levels crit,warn,info
#system,level2,level8,level9
#system,level2,level8,level9
include/UniSetActivator.h
View file @
808274cb
...
@@ -47,6 +47,7 @@ typedef std::shared_ptr<UniSetActivator> UniSetActivatorPtr;
...
@@ -47,6 +47,7 @@ typedef std::shared_ptr<UniSetActivator> UniSetActivatorPtr;
* Активатор в свою очередь сам является менеджером(и объектом) и обладает всеми его свойствами
* Активатор в свою очередь сам является менеджером(и объектом) и обладает всеми его свойствами
*
*
* --uniset-no-use-gdb-for-stacktrace - НЕ ИСПОЛЬЗОВАТЬ gdb для stacktrace
* --uniset-no-use-gdb-for-stacktrace - НЕ ИСПОЛЬЗОВАТЬ gdb для stacktrace
* --uniset-abort-script - скрипт запускаемый при вылете, в качестве аргумента передаётся имя программы и pid
*/
*/
class
UniSetActivator
:
class
UniSetActivator
:
public
UniSetManager
public
UniSetManager
...
@@ -80,6 +81,11 @@ class UniSetActivator:
...
@@ -80,6 +81,11 @@ class UniSetActivator:
return
_noUseGdbForStackTrace
;
return
_noUseGdbForStackTrace
;
}
}
inline
const
std
::
string
getAbortScript
()
{
return
abortScript
;
}
protected
:
protected
:
virtual
void
work
();
virtual
void
work
();
...
@@ -117,6 +123,8 @@ class UniSetActivator:
...
@@ -117,6 +123,8 @@ class UniSetActivator:
pid_t
thpid
;
// pid orb потока
pid_t
thpid
;
// pid orb потока
bool
_noUseGdbForStackTrace
=
{
false
};
bool
_noUseGdbForStackTrace
=
{
false
};
std
::
string
abortScript
=
{
""
};
// скрипт вызываемый при прерывании программы (SIGSEGV,SIGABRT)
};
};
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
#endif
#endif
...
...
src/ObjectRepository/UniSetActivator.cc
View file @
808274cb
...
@@ -266,9 +266,17 @@ bool gdb_print_trace()
...
@@ -266,9 +266,17 @@ bool gdb_print_trace()
dup2
(
fileno
(
stdout
),
fileno
(
stderr
));
dup2
(
fileno
(
stdout
),
fileno
(
stderr
));
TRACELOG
<<
"stack trace for "
<<
name_buf
<<
" pid="
<<
pid_buf
<<
endl
;
TRACELOG
<<
"stack trace for "
<<
name_buf
<<
" pid="
<<
pid_buf
<<
endl
;
// приходится выводить информацию по всем потокам, т.к. мы не знаем в каком сработал сигнал
if
(
g_act
&&
!
g_act
->
getAbortScript
().
empty
()
)
// его надо смотреть по выводу "<signal handler called>"
{
execlp
(
"gdb"
,
"gdb"
,
"--batch"
,
"-n"
,
"-ex"
,
"thread apply all bt"
,
name_buf
,
pid_buf
,
NULL
);
TRACELOG
<<
"run abort script "
<<
g_act
->
getAbortScript
()
<<
endl
;
execlp
(
g_act
->
getAbortScript
().
c_str
(),
g_act
->
getAbortScript
().
c_str
(),
name_buf
,
pid_buf
,
NULL
);
}
else
{
// приходится выводить информацию по всем потокам, т.к. мы не знаем в каком сработал сигнал
// его надо смотреть по выводу "<signal handler called>"
execlp
(
"gdb"
,
"gdb"
,
"--batch"
,
"-n"
,
"-ex"
,
"thread apply all bt"
,
name_buf
,
pid_buf
,
NULL
);
}
//abort(); /* If gdb failed to start */
//abort(); /* If gdb failed to start */
return
false
;
return
false
;
...
@@ -534,6 +542,8 @@ void UniSetActivator::init()
...
@@ -534,6 +542,8 @@ void UniSetActivator::init()
_noUseGdbForStackTrace
=
(
findArgParam
(
"--uniset-no-use-gdb-for-stacktrace"
,
conf
->
getArgc
(),
conf
->
getArgv
())
!=
-
1
);
_noUseGdbForStackTrace
=
(
findArgParam
(
"--uniset-no-use-gdb-for-stacktrace"
,
conf
->
getArgc
(),
conf
->
getArgv
())
!=
-
1
);
abortScript
=
conf
->
getArgParam
(
"--uniset-abort-script"
,
""
);
orb
=
conf
->
getORB
();
orb
=
conf
->
getORB
();
CORBA
::
Object_var
obj
=
orb
->
resolve_initial_references
(
"RootPOA"
);
CORBA
::
Object_var
obj
=
orb
->
resolve_initial_references
(
"RootPOA"
);
PortableServer
::
POA_var
root_poa
=
PortableServer
::
POA
::
_narrow
(
obj
);
PortableServer
::
POA_var
root_poa
=
PortableServer
::
POA
::
_narrow
(
obj
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment