Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
27f70ce5
Commit
27f70ce5
authored
Aug 22, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. off/on debug
parent
56a0dbca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
16 deletions
+92
-16
debugfs.js
src/debugfs-webgui/debugfs.js
+45
-9
debugfs.php
src/debugfs-webgui/debugfs.php
+47
-7
No files found.
src/debugfs-webgui/debugfs.js
View file @
27f70ce5
...
...
@@ -54,17 +54,37 @@ function init(){
var
f2
=
$
(
"<span title='Include module name in the printed message'>"
);
var
f3
=
$
(
"<span title='Include thread ID in messages not generated from interrupt context'>"
);
var
f0_cb
=
$
(
"<input>"
,{
id
:
"fflag"
,
type
:
"checkbox"
,
class
:
"tp"
}).
css
({
position
:
"relative"
,
top
:
"3px"
});
var
f1_cb
=
$
(
"<input>"
,{
id
:
"lflag"
,
type
:
"checkbox"
,
class
:
"tp"
}).
css
({
position
:
"relative"
,
top
:
"3px"
});
var
f2_cb
=
$
(
"<input>"
,{
id
:
"mflag"
,
type
:
"checkbox"
,
class
:
"tp"
}).
css
({
position
:
"relative"
,
top
:
"3px"
});
var
f3_cb
=
$
(
"<input>"
,{
id
:
"tflag"
,
type
:
"checkbox"
,
class
:
"tp"
}).
css
({
position
:
"relative"
,
top
:
"3px"
});
var
f0_cb
=
$
(
"<input>"
,{
id
:
"fflag"
,
type
:
"checkbox"
,
class
:
"tp
flags_cb
"
}).
css
({
position
:
"relative"
,
top
:
"3px"
});
var
f1_cb
=
$
(
"<input>"
,{
id
:
"lflag"
,
type
:
"checkbox"
,
class
:
"tp
flags_cb
"
}).
css
({
position
:
"relative"
,
top
:
"3px"
});
var
f2_cb
=
$
(
"<input>"
,{
id
:
"mflag"
,
type
:
"checkbox"
,
class
:
"tp
flags_cb
"
}).
css
({
position
:
"relative"
,
top
:
"3px"
});
var
f3_cb
=
$
(
"<input>"
,{
id
:
"tflag"
,
type
:
"checkbox"
,
class
:
"tp
flags_cb
"
}).
css
({
position
:
"relative"
,
top
:
"3px"
});
f0
.
html
(
" f "
).
append
(
f0_cb
);
f1
.
html
(
" l "
).
append
(
f1_cb
);
f2
.
html
(
" m "
).
append
(
f2_cb
);
f3
.
html
(
" t "
).
append
(
f3_cb
);
var
b3
=
$
(
"<button>"
,{
title
:
"Enable/disable debug messages for selected files"
}).
css
({
margin
:
"0px 0px 0px 10px"
}).
html
(
"Switch off debug"
).
click
(
function
(){
if
(
$
(
this
).
html
()
==
"Switch off debug"
){
$
(
this
).
html
(
"Switch on debug"
);
$
.
ajax
({
url
:
"debugfs.php?cmd=setflag&flag=-p"
,
queue
:
true
});
}
else
{
$
(
this
).
html
(
"Switch off debug"
);
$
.
ajax
({
url
:
"debugfs.php?cmd=setflag&flag=%2Bp"
,
queue
:
true
});
}
});
$
(
"body"
).
append
(
$
(
"<div>"
).
css
({
padding
:
"0px 0px 10px 0px"
}).
append
(
b0
).
append
(
b1
).
append
(
b2
).
append
(
f0
).
append
(
f1
).
append
(
f2
).
append
(
f3
));
$
(
"body"
).
append
(
$
(
"<div>"
).
css
({
padding
:
"0px 0px 10px 0px"
}).
append
(
b0
).
append
(
b1
).
append
(
b2
).
append
(
b3
).
append
(
f0
).
append
(
f1
).
append
(
f2
).
append
(
f3
));
//list header
var
t
=
$
(
"<table border=
\"
1
\"
>"
).
html
(
"
\
...
...
@@ -126,6 +146,22 @@ function init(){
update_debugfs_config
();
});
$
(
".flags_cb"
).
change
(
function
(){
if
(
$
(
this
).
prop
(
"checked"
))
sign
=
"%2B"
;
else
sign
=
"-"
;
flag
=
$
(
this
).
attr
(
"id"
)[
0
];
$
.
ajax
({
url
:
"debugfs.php?cmd=setflag&flag="
+
sign
+
flag
,
queue
:
true
});
});
//init flags
$
(
".flags_cb"
).
prop
(
"checked"
,
true
);
$
(
".flags_cb"
).
change
();
//when everything is parsed. do something.
// unique IDs
// save config
...
...
@@ -200,10 +236,10 @@ function fill_content_rebind_events(){
var
subindex
=
$
(
this
).
attr
(
"subindex"
);
var
flags
=
""
;
if
(
$
(
"#tflag"
).
prop
(
"checked"
))
flags
+=
"t
"
;
if
(
$
(
"#mflag"
).
prop
(
"checked"
))
flags
+=
"m
"
;
if
(
$
(
"#lflag"
).
prop
(
"checked"
))
flags
+=
"l
"
;
if
(
$
(
"#fflag"
).
prop
(
"checked"
))
flags
+=
"f
"
;
//if ($("#fflag").prop("checked")) flags += "f
";
//if ($("#lflag").prop("checked")) flags += "l
";
//if ($("#mflag").prop("checked")) flags += "m
";
//if ($("#tflag").prop("checked")) flags += "t
";
if
(
$
(
this
).
prop
(
"checked"
))
flags
=
"p"
+
flags
;
else
flags
=
"_"
;
...
...
src/debugfs-webgui/debugfs.php
View file @
27f70ce5
...
...
@@ -100,6 +100,7 @@ function update_config($data){
function
apply_config_to_control
(){
global
$tmp_config
,
$DEBUGFSFILE
;
$arr_config
=
json_decode
(
file_get_contents
(
$tmp_config
),
true
);
foreach
(
$arr_config
as
$k0
=>
$v0
){
if
(
$v0
[
'state'
]
==
1
){
...
...
@@ -121,26 +122,55 @@ function apply_config_to_control(){
echo
"Done"
;
}
function
apply_flag
(
$flag
){
global
$tmp_config
,
$DEBUGFSFILE
;
//echo "<pre>\n";
$arr_config
=
json_decode
(
file_get_contents
(
$tmp_config
),
true
);
foreach
(
$arr_config
as
$k0
=>
$v0
){
if
(
$v0
[
'state'
]
==
1
){
foreach
(
$v0
[
'configs'
]
as
$k1
=>
$v1
){
if
(
$v1
[
'state'
]
==
1
){
foreach
(
$v1
[
'lines'
]
as
$k2
=>
$v2
){
$file
=
$v2
[
'file'
];
$lineno
=
$v2
[
'lineno'
];
$cmd
=
"echo -n 'file
$file
line
$lineno
$flag
' >
$DEBUGFSFILE
"
;
//echo "$cmd\n";
exec
(
$cmd
);
//echo "echo -n 'file $file line $lineno ${sign}p'\n";
}
}
}
}
}
echo
"Done"
;
}
function
sync_from_debugfs_to_config
(
$file
,
$line
,
$flags
,
$sign
){
global
$tmp_config
;
//$arr_debugfs = get_control("/sys/kernel/debug/dynamic_debug/control");
$arr_config
=
json_decode
(
file_get_contents
(
$tmp_config
),
true
);
$err
=
0
;
$dc
=
0
;
$dcc
=
0
;
$dccc
=
0
;
foreach
(
$arr_config
as
$k
=>
$v
){
if
(
$v
[
'file'
]
==
$file
)
{
$dc
=
$k
;
$err
=
$err
+
1
;
break
;
}
}
echo
"DC=
$dc
\n
"
;
$tmp_arr1
=
$arr_config
[
$dc
][
'configs'
];
foreach
(
$tmp_arr1
as
$k
=>
$v
){
if
(
$v
[
'state'
]
==
1
)
{
$dcc
=
$k
;
$err
=
$err
+
2
;
break
;
}
}
...
...
@@ -150,6 +180,7 @@ function sync_from_debugfs_to_config($file,$line,$flags,$sign){
foreach
(
$tmp_arr2
as
$k
=>
$v
){
if
(
$v
[
'lineno'
]
==
$line
)
{
$dccc
=
$k
;
$err
=
$err
+
4
;
break
;
}
}
...
...
@@ -157,10 +188,14 @@ function sync_from_debugfs_to_config($file,$line,$flags,$sign){
if
(
$sign
==
"+"
)
$flag
=
"p"
;
else
$flag
=
"_"
;
$arr_config
[
$dc
][
'configs'
][
$dcc
][
'lines'
][
$dccc
][
'flags'
]
=
$flag
;
update_config
(
json_encode
(
$arr_config
));
//print_r($arr_config);
echo
"file index:
$dc
, config index:
$dcc
, line index:
$dccc
\n
"
;
if
(
$err
==
7
){
$arr_config
[
$dc
][
'configs'
][
$dcc
][
'lines'
][
$dccc
][
'flags'
]
=
$flag
;
update_config
(
json_encode
(
$arr_config
));
}
else
{
echo
"error code:
$err
"
;
}
}
function
filter_record_by_file
(
$a
,
$f
){
...
...
@@ -245,6 +280,11 @@ if ($cmd=="reread"){
//echo "<pre>";print_r($filtered);
}
if
(
$cmd
==
"setflag"
){
$flag
=
$_GET
[
'flag'
];
apply_flag
(
$flag
);
}
//single line: echo -n 'file gamma_tables.c +p' > /sys/kernel/debug/dynamic_debug/control
?>
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