Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常顺宇
OpenXG-RAN
Commits
4911b107
Commit
4911b107
authored
May 01, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
instrument X using gcc's -finstrument-functions
used to debug locking
parent
951882ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
common/utils/T/tracer/gui/Makefile
common/utils/T/tracer/gui/Makefile
+3
-0
common/utils/T/tracer/gui/gui.c
common/utils/T/tracer/gui/gui.c
+16
-0
No files found.
common/utils/T/tracer/gui/Makefile
View file @
4911b107
...
@@ -10,6 +10,9 @@ gui.a: $(OBJS)
...
@@ -10,6 +10,9 @@ gui.a: $(OBJS)
test
:
test.o gui.a
test
:
test.o gui.a
$(CC)
-o
test
$(OBJS)
test.o
-lX11
-pthread
-lm
$(CC)
-o
test
$(OBJS)
test.o
-lX11
-pthread
-lm
x.o
:
x.c
$(CC)
$(CFLAGS)
-o
$@
-c
$<
-finstrument-functions
%.o
:
%.c
%.o
:
%.c
$(CC)
$(CFLAGS)
-o
$@
-c
$<
$(CC)
$(CFLAGS)
-o
$@
-c
$<
...
...
common/utils/T/tracer/gui/gui.c
View file @
4911b107
...
@@ -5,15 +5,31 @@
...
@@ -5,15 +5,31 @@
#include <stdlib.h>
#include <stdlib.h>
#include <pthread.h>
#include <pthread.h>
static
volatile
int
locked
=
0
;
void
__cyg_profile_func_enter
(
void
*
func
,
void
*
caller
)
{
if
(
locked
==
0
)
abort
();
printf
(
"E %p %p %lu
\n
"
,
func
,
caller
,
time
(
NULL
));
}
void
__cyg_profile_func_exit
(
void
*
func
,
void
*
caller
)
{
if
(
locked
==
0
)
abort
();
printf
(
"X %p %p %lu
\n
"
,
func
,
caller
,
time
(
NULL
));
}
void
glock
(
gui
*
_gui
)
void
glock
(
gui
*
_gui
)
{
{
struct
gui
*
g
=
_gui
;
struct
gui
*
g
=
_gui
;
if
(
pthread_mutex_lock
(
g
->
lock
))
ERR
(
"mutex error
\n
"
);
if
(
pthread_mutex_lock
(
g
->
lock
))
ERR
(
"mutex error
\n
"
);
locked
=
1
;
}
}
void
gunlock
(
gui
*
_gui
)
void
gunlock
(
gui
*
_gui
)
{
{
struct
gui
*
g
=
_gui
;
struct
gui
*
g
=
_gui
;
locked
=
0
;
if
(
pthread_mutex_unlock
(
g
->
lock
))
ERR
(
"mutex error
\n
"
);
if
(
pthread_mutex_unlock
(
g
->
lock
))
ERR
(
"mutex error
\n
"
);
}
}
...
...
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