Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KOS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Karsten
KOS
Commits
c4381bc3
Commit
c4381bc3
authored
6 years ago
by
Martin Karsten
Browse files
Options
Downloads
Patches
Plain Diff
- minor bugfixes in gdb support and webserver program
parent
bab3c557
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/libfibre/libfibre.so-gdb.py
+18
-1
18 additions, 1 deletion
src/libfibre/libfibre.so-gdb.py
src/libfibre/webserver.cpp
+9
-7
9 additions, 7 deletions
src/libfibre/webserver.cpp
src/libfibre/webserver.go
+3
-1
3 additions, 1 deletion
src/libfibre/webserver.go
with
30 additions
and
9 deletions
src/libfibre/libfibre.so-gdb.py
+
18
−
1
View file @
c4381bc3
...
...
@@ -6,12 +6,16 @@ import gdb
from
contextlib
import
contextmanager
class
FibreSupport
():
def
__init__
(
self
):
FibreSupport
.
saved
=
False
def
stop_handler
(
event
):
if
(
gdb
.
lookup_symbol
(
"
_globalStackList
"
)[
0
]
==
None
):
print
(
"
WARNING: no fibre debugging support - did you enable TESTING_ENABLE_DEBUGGING?
"
)
return
FibreSupport
.
list
=
[]
FibreSupport
.
active
=
{}
FibreSupport
.
saved
=
True
# save register context for later continuation
FibreSupport
.
rsp
=
str
(
gdb
.
parse_and_eval
(
"
$rsp
"
)).
split
(
None
,
1
)[
0
]
FibreSupport
.
rbp
=
str
(
gdb
.
parse_and_eval
(
"
$rbp
"
)).
split
(
None
,
1
)[
0
]
...
...
@@ -37,7 +41,7 @@ class FibreSupport():
}
orig_thread
.
switch
()
# restore() is hooked to continue events via
basic
script hooks
# restore() is hooked to continue events via script hooks
to 'fibre reset'
def
restore
():
FibreSupport
.
prep_frame
()
# restore original register context
...
...
@@ -45,6 +49,7 @@ class FibreSupport():
gdb
.
execute
(
"
set $rbp =
"
+
str
(
FibreSupport
.
rbp
))
gdb
.
execute
(
"
set $rip =
"
+
str
(
FibreSupport
.
rip
))
gdb
.
execute
(
"
set Context::currStack =
"
+
str
(
FibreSupport
.
currStack
))
FibreSupport
.
saved
=
False
def
prep_frame
():
# walk stack down to innermost frame
...
...
@@ -138,6 +143,8 @@ class InfoFibres(gdb.Command):
super
(
InfoFibres
,
self
).
__init__
(
"
info fibres
"
,
gdb
.
COMMAND_USER
)
def
invoke
(
self
,
arg
,
from_tty
):
if
(
not
FibreSupport
.
saved
):
return
curr
=
gdb
.
parse_and_eval
(
"
Context::currStack
"
)
print
(
"
Idx
\t
Target
\t
Ptr
\t\t
Frame
"
)
for
i
in
range
(
len
(
FibreSupport
.
list
)):
...
...
@@ -169,6 +176,8 @@ class FibrePtr(gdb.Command):
super
(
FibrePtr
,
self
).
__init__
(
"
fibre ptr
"
,
gdb
.
COMMAND_USER
)
def
invoke
(
self
,
arg
,
from_tty
):
if
(
not
FibreSupport
.
saved
):
return
FibreSupport
.
backtrace
(
gdb
.
parse_and_eval
(
arg
))
class
FibreIdx
(
gdb
.
Command
):
...
...
@@ -177,6 +186,8 @@ class FibreIdx(gdb.Command):
super
(
FibreIdx
,
self
).
__init__
(
"
fibre idx
"
,
gdb
.
COMMAND_USER
)
def
invoke
(
self
,
arg
,
from_tty
):
if
(
not
FibreSupport
.
saved
):
return
index
=
int
(
gdb
.
parse_and_eval
(
arg
))
if
(
index
>=
len
(
FibreSupport
.
list
)):
print
(
"
fibre
"
,
index
,
"
does not exist
"
)
...
...
@@ -189,6 +200,8 @@ class FibreSetPtr(gdb.Command):
super
(
FibreSetPtr
,
self
).
__init__
(
"
fibre setptr
"
,
gdb
.
COMMAND_USER
)
def
invoke
(
self
,
arg
,
from_tty
):
if
(
not
FibreSupport
.
saved
):
return
FibreSupport
.
prep_frame
()
FibreSupport
.
set_fibre
(
gdb
.
parse_and_eval
(
arg
))
...
...
@@ -198,6 +211,8 @@ class FibreSetIdx(gdb.Command):
super
(
FibreSetIdx
,
self
).
__init__
(
"
fibre setidx
"
,
gdb
.
COMMAND_USER
)
def
invoke
(
self
,
arg
,
from_tty
):
if
(
not
FibreSupport
.
saved
):
return
index
=
int
(
gdb
.
parse_and_eval
(
arg
))
if
(
index
>=
len
(
FibreSupport
.
list
)):
print
(
"
fibre
"
,
index
,
"
does not exist
"
)
...
...
@@ -212,6 +227,8 @@ before continuing the target with 'step', 'next', 'cont', etc..."""
super
(
FibreReset
,
self
).
__init__
(
"
fibre reset
"
,
gdb
.
COMMAND_USER
)
def
invoke
(
self
,
arg
,
from_tty
):
if
(
not
FibreSupport
.
saved
):
return
FibreSupport
.
restore
()
FibreSupport
()
...
...
This diff is collapsed.
Click to expand it.
src/libfibre/webserver.cpp
+
9
−
7
View file @
c4381bc3
...
...
@@ -161,6 +161,9 @@ static void opts(int argc, char** argv) {
if
(
clusterSize
==
0
||
threadCount
==
0
)
{
cerr
<<
"none of -c, -t can be zero"
<<
endl
;
}
#if defined __U_CPLUSPLUS__
singleServerSocket
=
true
;
#endif
}
static
const
char
*
RESPONSE
=
"HTTP/1.1 200 OK
\r\n
"
\
...
...
@@ -201,11 +204,10 @@ static inline bool connHandler(void* connFD) {
/* read request(s) */
ssize_t
rret
;
#if defined __U_CPLUSPLUS__
for
(;;)
{
try
{
rret
=
((
uSocketAccept
*
)
connFD
)
->
recv
(
buf
+
buflen
,
sizeof
(
buf
)
-
buflen
,
0
);
if
(
rret
>
0
)
break
;
}
catch
(
uSocketAccept
::
ReadFailure
&
rderr
)
{}
try
{
rret
=
((
uSocketAccept
*
)
connFD
)
->
recv
(
buf
+
buflen
,
sizeof
(
buf
)
-
buflen
,
0
);
}
catch
(
uSocketAccept
::
ReadFailure
&
rderr
)
{
goto
closeAndOut
;
}
#else
while
((
rret
=
lfInput
(
recv
,
(
uintptr_t
)
connFD
,
(
void
*
)(
buf
+
buflen
),
sizeof
(
buf
)
-
buflen
,
0
))
<
0
&&
errno
==
EINTR
);
...
...
@@ -285,7 +287,7 @@ closeAndOut:
#endif
return
false
;
}
#if defined __U_CPLUSPLUS__
static
uSocketServer
*
create_socket
()
{
return
new
uSocketServer
(
8800
,
SOCK_STREAM
,
0
,
maxBacklog
);
...
...
@@ -491,7 +493,7 @@ static void scopemain() {
// wait for all listeners
for
(
Fibre
*
f
:
fibreList
)
delete
f
;
// close server socket, if neccessary
// close server socket, if neccessary
if
(
singleServerSocket
)
{
#if defined __U_CPLUSPLUS__
delete
servFD
;
...
...
This diff is collapsed.
Click to expand it.
src/libfibre/webserver.go
+
3
−
1
View file @
c4381bc3
...
...
@@ -12,8 +12,10 @@ import (
)
var
(
clusterSize
=
flag
.
Int
(
"c"
,
64
,
"Size of clusters (ignored)"
)
clusterSize
=
flag
.
Int
(
"c"
,
64
,
"Size of clusters (compatibility only, ignored)"
)
scopeCount
=
flag
.
Int
(
"e"
,
64
,
"Number of event scopes (compatibility only, ignored)"
)
listenerCount
=
flag
.
Int
(
"l"
,
1
,
"Number of listeners"
)
singleServerSocket
=
flag
.
Bool
(
"m"
,
true
,
"socket per listener compatibility only, ignored)"
)
threadcount
=
flag
.
Int
(
"t"
,
1
,
"Number of system threads"
)
listenAddr
=
flag
.
String
(
"addr"
,
":8800"
,
"TCP address to listen to"
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment