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
1222ee72
Commit
1222ee72
authored
Aug 18, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added debugfs-webgui
parent
a2e29be3
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
566 additions
and
139 deletions
+566
-139
Makefile
Makefile
+1
-1
Makefile
src/debugfs-webgui/Makefile
+21
-0
debugfs.css
src/debugfs-webgui/debugfs.css
+56
-0
debugfs.html
src/debugfs-webgui/debugfs.html
+11
-0
debugfs.js
src/debugfs-webgui/debugfs.js
+141
-0
debugfs.php
src/debugfs-webgui/debugfs.php
+154
-0
framepars.php
src/php_top/framepars.php
+182
-138
No files found.
Makefile
View file @
1222ee72
# Runs 'make', 'make install', and 'make clean' in specified subdirectories
# Runs 'make', 'make install', and 'make clean' in specified subdirectories
SUBDIRS
:=
src/php_top src/python_tests
# src1
SUBDIRS
:=
src/php_top src/python_tests
src/debugfs-webgui
# src1
INSTALLDIRS
=
$
(
SUBDIRS:%
=
install-%
)
INSTALLDIRS
=
$
(
SUBDIRS:%
=
install-%
)
CLEANDIRS
=
$
(
SUBDIRS:%
=
clean-%
)
CLEANDIRS
=
$
(
SUBDIRS:%
=
clean-%
)
...
...
src/debugfs-webgui/Makefile
0 → 100644
View file @
1222ee72
DOCUMENTROOT
=
$(DESTDIR)
/www/pages
OWN
=
-o
root
-g
root
INSTDOCS
=
0644
INSTALL
=
install
DOCS
=
debugfs.html
\
debugfs.css
\
debugfs.js
PHP_SCRIPTS
=
debugfs.php
all
:
@
echo
"make all in src"
install
:
@
echo
"make install in src"
$(INSTALL)
$(OWN)
-d
$(DOCUMENTROOT)
$(INSTALL)
$(OWN)
-m
$(INSTDOCS)
$(DOCS)
$(DOCUMENTROOT)
$(INSTALL)
$(OWN)
-m
$(INSTDOCS)
$(PHP_SCRIPTS)
$(DOCUMENTROOT)
clean
:
@
echo
"make clean in src"
src/debugfs-webgui/debugfs.css
0 → 100644
View file @
1222ee72
html
{
font-family
:
Arial
;
font-size
:
0.8em
;
}
body
{
padding
:
10px
;
}
table
{
border-collapse
:
collapse
;
border-radius
:
3px
;
}
th
,
td
{
text-align
:
left
;
padding
:
3px
10px
3px
10px
;
border-radius
:
0px
;
border
:
1px
solid
rgba
(
180
,
180
,
180
,
0.5
)
}
th
{
background-color
:
rgba
(
200
,
200
,
200
,
0.5
);
}
.even
{
background-color
:
rgba
(
235
,
235
,
235
,
0.5
);
}
.odd
{
background-color
:
rgba
(
255
,
255
,
255
,
0.5
);
}
.special
{
background-color
:
rgba
(
100
,
200
,
100
,
0.5
);
}
select
{
border
:
1px
solid
rgba
(
200
,
200
,
200
,
1
);
border-radius
:
2px
;
font-family
:
Arial
;
font-size
:
1em
;
background-color
:
rgba
(
200
,
200
,
200
,
0.5
);
margin
:
0px
;
padding
:
1px
;
}
input
{
-moz-appearance
:
none
;
border
:
1px
solid
rgba
(
200
,
200
,
200
,
1
);
}
.tp
{
width
:
20px
;
height
:
20px
;
}
\ No newline at end of file
src/debugfs-webgui/debugfs.html
0 → 100644
View file @
1222ee72
<html>
<head>
<script
src=
"js/jquery-2.2.3.min.js"
></script>
<script
src=
"debugfs.js"
></script>
<script
src=
"js/bootstrap/js/bootstrap.min.js"
></script>
<link
rel=
"stylesheet"
href=
"js/bootstrap/css/bootstrap.min.css"
/>
<link
rel=
"stylesheet"
href=
"debugfs.css"
/>
</head>
<body
onload=
'init()'
>
</body>
</html>
\ No newline at end of file
src/debugfs-webgui/debugfs.js
0 → 100644
View file @
1222ee72
var
debugfs_data
;
function
init
(){
$
(
"body"
).
html
(
"<h3>DebugFS:</h3>"
);
var
b0
=
$
(
"<button>"
,{
id
:
"b0"
}).
html
(
"toggle hidden"
);
b0
.
prop
(
"state"
,
0
);
b0
.
click
(
function
(){
if
(
$
(
this
).
prop
(
"state"
)
==
0
){
$
(
this
).
prop
(
"state"
,
1
)
$
(
".hidden_rows"
).
show
();
}
else
{
$
(
this
).
prop
(
"state"
,
0
)
$
(
".hidden_rows"
).
hide
();
}
});
$
(
"body"
).
append
(
$
(
"<div>"
).
css
({
padding
:
"0px 0px 10px 0px"
}).
append
(
b0
));
var
t
=
$
(
"<table border=
\"
1
\"
>"
).
html
(
"
\
<tr>
\
<th style='display:none;' class='hidden_rows'>Show</th>
\
<th>File</th>
\
</tr>
\
"
);
$
(
"body"
).
append
(
t
);
$
.
ajax
({
url
:
"debugfs.php"
,
success
:
function
(
data
){
var
r
=
jQuery
.
parseJSON
(
data
);
//global
debugfs_data
=
r
;
for
(
var
i
=
0
;
i
<
r
.
length
;
i
++
){
l
=
$
(
"<tr>"
,{
id
:
"row_"
+
i
}).
html
(
"
\
<td class='hidden_rows' style='text-align:center;display:none' >
\
<input id='cb_"
+
i
+
"' class='tp visibility_cb' type='checkbox'>
\
</td>
\
<td class='special filename' id='header_"
+
i
+
" '>"
+
r
[
i
].
file
+
"</td>
\
"
);
if
(
r
[
i
].
state
==
0
){
l
.
addClass
(
"hidden_rows"
).
hide
();
l
.
find
(
"input"
).
prop
(
"checked"
,
false
);
}
else
{
l
.
removeClass
(
"hidden_rows"
).
show
();
l
.
find
(
"input"
).
prop
(
"checked"
,
true
);
}
content
=
$
(
"<tr>"
,{
id
:
"content_"
+
i
}).
css
({
display
:
"none"
,
border
:
"0px solid rgba(255,255,255,0)"
});
content
.
append
(
$
(
"<td>"
).
addClass
(
"hidden_rows"
).
hide
()
).
append
(
$
(
"<td>"
).
append
(
$
(
"<table>"
).
css
({
margin
:
"5px"
})
)
);
//.append($("<td>").addClass("hidden_rows").css({display:"none"}))
t
.
append
(
l
).
append
(
content
);
var
r1
=
r
[
i
].
configs
[
0
].
lines
;
for
(
var
j
=
0
;
j
<
r1
.
length
;
j
++
){
ttl
=
"module: "
+
r1
[
j
].
module
+
"
\n
"
;
ttl
+=
"function: "
+
r1
[
j
].
function
+
"
\n
"
;
ttl
+=
"format: "
+
r1
[
j
].
format
;
if
(
r1
[
j
].
flags
==
"p"
){
checked
=
"checked"
;
}
else
{
checked
=
""
;
}
l
=
"<tr>"
;
l
+=
" <td style='text-align:center' title='"
+
ttl
+
"'>"
+
r1
[
j
].
lineno
+
"</td>"
;
l
+=
" <td style='text-align:center'><input type='checkbox' class='tp debug' "
+
checked
+
" file='"
+
r1
[
j
].
file
+
"' line='"
+
r1
[
j
].
lineno
+
"' /></td>"
;
l
+=
"</tr>"
;
content
.
find
(
"table"
).
append
(
l
);
}
}
//init actions
$
(
".debug"
).
change
(
function
(){
console
.
log
(
$
(
this
).
attr
(
"file"
)
+
", "
+
$
(
this
).
attr
(
"line"
)
+
", "
+
$
(
this
).
prop
(
"checked"
));
$
.
ajax
({
url
:
"debugfs.php?cmd=echo&file="
+
$
(
this
).
attr
(
"file"
)
+
"&line="
+
$
(
this
).
attr
(
"line"
)
+
"&pflag="
+
$
(
this
).
prop
(
"checked"
)
});
});
$
(
".filename"
).
click
(
function
(){
var
id
=
$
(
this
).
attr
(
"id"
);
id
=
id
.
substr
(
id
.
indexOf
(
"_"
)
+
1
);
console
.
log
(
id
);
$
(
"#content_"
+
id
).
toggle
();
});
$
(
".visibility_cb"
).
change
(
function
(){
var
id
=
$
(
this
).
attr
(
"id"
);
id
=
id
.
substr
(
id
.
indexOf
(
"_"
)
+
1
);
if
(
$
(
this
).
prop
(
"checked"
)){
$
(
"#row_"
+
id
).
removeClass
(
"hidden_rows"
);
debugfs_data
[
id
].
state
=
1
;
}
else
{
$
(
"#row_"
+
id
).
addClass
(
"hidden_rows"
);
$
(
"#content_"
+
id
).
hide
();
debugfs_data
[
id
].
state
=
0
;
}
update_debugfs_config
();
});
//when everything is parsed. do something.
// unique IDs
// save config
}
});
}
function
update_debugfs_config
(){
console
.
log
(
"syncing debugfs config"
);
console
.
log
(
debugfs_data
);
$
.
ajax
({
type
:
"POST"
,
url
:
"debugfs.php?cmd=sync"
,
data
:
JSON
.
stringify
(
debugfs_data
),
dataType
:
"json"
});
}
src/debugfs-webgui/debugfs.php
0 → 100644
View file @
1222ee72
<?php
if
(
isset
(
$_GET
[
'cmd'
]))
$cmd
=
$_GET
[
'cmd'
];
else
$cmd
=
"do_nothing"
;
function
get_control
(
$f
){
$res
=
Array
();
$results
=
trim
(
file_get_contents
(
$f
));
//print("<pre>");
$ress
=
explode
(
"
\n
"
,
$results
);
//filename - find first ":"
//lineno - between ":" and " "
//then [module] inside brackets
//function from "]" to " "
$oldfile
=
""
;
foreach
(
$ress
as
$line
){
if
(
$line
[
0
]
==
"#"
)
continue
;
$d0
=
0
;
$d1
=
strpos
(
$line
,
":"
);
$d2
=
strpos
(
$line
,
"["
);
$d3
=
strpos
(
$line
,
"]"
);
preg_match
(
"/=[flmpt_]+/"
,
$line
,
$matches
,
PREG_OFFSET_CAPTURE
);
$d4
=
$matches
[
0
][
1
];
$d5
=
strpos
(
$line
,
"
\"
"
);
$subarr
=
Array
();
$subarr
[
'file'
]
=
substr
(
$line
,
0
,
$d1
);
$subarr
[
'lineno'
]
=
substr
(
$line
,
$d1
+
1
,(
$d2
-
1
)
-
$d1
-
1
);
$subarr
[
'module'
]
=
substr
(
$line
,
$d2
+
1
,(
$d3
-
1
)
-
$d2
);
$subarr
[
'function'
]
=
substr
(
$line
,
$d3
+
1
,(
$d4
-
1
)
-
$d3
);
$subarr
[
'flags'
]
=
substr
(
$line
,
$d4
+
1
,
1
);
$subarr
[
'format'
]
=
substr
(
$line
,
$d5
+
1
,
-
1
);
if
(
$subarr
[
'file'
]
!=
$oldfile
){
echo
"processing "
.
$subarr
[
'file'
]
.
"
\n
"
;
if
(
$oldfile
!=
""
)
array_push
(
$res
,
$sub
);
$oldfile
=
$subarr
[
'file'
];
$sub
=
Array
(
"file"
=>
$subarr
[
'file'
],
"state"
=>
0
,
"configs"
=>
Array
(
Array
(
"name"
=>
"default"
,
"state"
=>
1
,
"lines"
=>
Array
()
)
)
);
}
array_push
(
$sub
[
'configs'
][
0
][
'lines'
],
$subarr
);
}
//last
array_push
(
$res
,
$sub
);
return
$res
;
}
function
update_config
(
$data
){
// debugfs.json
file_put_contents
(
"debugfs.json"
,
$data
);
}
function
sync_to_config
(
$file
,
$line
,
$flag
){
//$arr_debugfs = get_control("/sys/kernel/debug/dynamic_debug/control");
$arr_config
=
json_decode
(
file_get_contents
(
"debugfs.json"
),
true
);
foreach
(
$arr_config
as
$k
=>
$v
){
if
(
$v
[
'file'
]
==
$file
)
$dc
=
$k
;
}
echo
"DC=
$dc
\n
"
;
$tmp_arr1
=
$arr_config
[
$dc
][
'configs'
];
foreach
(
$tmp_arr1
as
$k
=>
$v
){
if
(
$v
[
'state'
]
==
1
)
$dcc
=
$k
;
}
$tmp_arr2
=
$arr_config
[
$dc
][
'configs'
][
$dcc
][
'lines'
];
foreach
(
$tmp_arr2
as
$k
=>
$v
){
if
(
$v
[
'lineno'
]
==
$line
)
$dccc
=
$k
;
}
if
(
$flag
==
"+"
)
$flag
=
"p"
;
else
$flag
=
"_"
;
$arr_config
[
$dc
][
'configs'
][
$dcc
][
'lines'
][
$dccc
][
'flags'
]
=
$flag
;
print_r
(
$arr_config
);
update_config
(
json_encode
(
$arr_config
));
}
if
((
$cmd
==
"do_nothing"
)
||
(
$cmd
==
"restore"
)){
if
(
isset
(
$_GET
[
'file'
]))
$file
=
$_GET
[
'file'
];
else
$file
=
"/sys/kernel/debug/dynamic_debug/control"
;
//echo json_encode(get_control($file));
//echo "<pre>";
if
(
!
is_file
(
"debugfs.json"
))
{
$arr
=
get_control
(
$file
);
print_r
(
$arr
);
update_config
(
json_encode
(
$arr
));
echo
"debugfs.json was missing, refresh page
\n
"
;
}
else
{
$json_data
=
file_get_contents
(
"debugfs.json"
);
//print_r(json_decode($json_data));
echo
$json_data
;
}
}
if
(
$cmd
==
"echo"
)
{
$file
=
$_GET
[
'file'
];
$line
=
$_GET
[
'line'
];
$flag
=
$_GET
[
'pflag'
];
//$config name
if
(
$flag
==
"true"
){
$flag
=
"+"
;
}
else
{
$flag
=
"-"
;
}
exec
(
"echo -n 'file
$file
line
$line
${flag}p' > /sys/kernel/debug/dynamic_debug/control"
);
sync_to_config
(
$file
,
$line
,
$flag
);
}
$debugfs_configs
=
"debugfs_configs"
;
if
(
$cmd
==
"save"
){
$file
=
$_GET
[
'file'
];
if
(
!
is_dir
(
$debugfs_configs
))
mkdir
(
$debugfs_configs
);
file_put_contents
(
"
$debugfs_configs
/
$file
"
,
file_get_contents
(
"/sys/kernel/debug/dynamic_debug/control"
));
}
if
(
$cmd
==
"sync"
){
//list saved configs here
$data
=
file_get_contents
(
"php://input"
);
update_config
(
$data
);
}
//single line: echo -n 'file gamma_tables.c +p' > /sys/kernel/debug/dynamic_debug/control
?>
src/php_top/framepars.php
View file @
1222ee72
This diff is collapsed.
Click to expand it.
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