Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
1a2ddac2
Commit
1a2ddac2
authored
May 01, 2016
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cc: Style fixes
parent
051d3e95
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
35 deletions
+33
-35
src/cc/bcc_syms.cc
src/cc/bcc_syms.cc
+2
-2
src/cc/bcc_syms.h
src/cc/bcc_syms.h
+1
-1
src/cc/usdt.cc
src/cc/usdt.cc
+28
-30
src/cc/usdt.h
src/cc/usdt.h
+2
-2
No files found.
src/cc/bcc_syms.cc
View file @
1a2ddac2
src/cc/bcc_syms.h
View file @
1a2ddac2
src/cc/usdt.cc
View file @
1a2ddac2
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
#include <sstream>
#include <cstring>
#include <cstring>
#include <sstream>
#include <fcntl.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/types.h>
...
@@ -50,10 +50,12 @@ bool Probe::in_shared_object() {
...
@@ -50,10 +50,12 @@ bool Probe::in_shared_object() {
return
in_shared_object_
.
value
();
return
in_shared_object_
.
value
();
}
}
bool
Probe
::
resolve_global_address
(
uint64_t
*
global
,
const
uint64_t
addr
,
optional
<
int
>
pid
)
{
bool
Probe
::
resolve_global_address
(
uint64_t
*
global
,
const
uint64_t
addr
,
optional
<
int
>
pid
)
{
if
(
in_shared_object
())
{
if
(
in_shared_object
())
{
return
(
pid
&&
return
(
pid
&&
bcc_resolve_global_addr
(
*
pid
,
bin_path_
.
c_str
(),
addr
,
global
)
==
0
);
bcc_resolve_global_addr
(
*
pid
,
bin_path_
.
c_str
(),
addr
,
global
)
==
0
);
}
}
*
global
=
addr
;
*
global
=
addr
;
...
@@ -144,8 +146,7 @@ bool Probe::usdt_cases(std::ostream &stream, const optional<int> &pid) {
...
@@ -144,8 +146,7 @@ bool Probe::usdt_cases(std::ostream &stream, const optional<int> &pid) {
const
size_t
arg_count
=
locations_
[
0
].
arguments_
.
size
();
const
size_t
arg_count
=
locations_
[
0
].
arguments_
.
size
();
for
(
size_t
arg_n
=
0
;
arg_n
<
arg_count
;
++
arg_n
)
{
for
(
size_t
arg_n
=
0
;
arg_n
<
arg_count
;
++
arg_n
)
{
tfm
::
format
(
stream
,
"%s arg%d = 0;
\n
"
,
tfm
::
format
(
stream
,
"%s arg%d = 0;
\n
"
,
largest_arg_type
(
arg_n
),
arg_n
+
1
);
largest_arg_type
(
arg_n
),
arg_n
+
1
);
}
}
for
(
size_t
loc_n
=
0
;
loc_n
<
locations_
.
size
();
++
loc_n
)
{
for
(
size_t
loc_n
=
0
;
loc_n
<
locations_
.
size
();
++
loc_n
)
{
...
@@ -192,8 +193,8 @@ bool Probe::usdt_getarg(std::ostream &stream, const optional<int> &pid) {
...
@@ -192,8 +193,8 @@ bool Probe::usdt_getarg(std::ostream &stream, const optional<int> &pid) {
if
(
locations_
.
size
()
==
1
)
{
if
(
locations_
.
size
()
==
1
)
{
Location
&
location
=
locations_
.
front
();
Location
&
location
=
locations_
.
front
();
stream
<<
" "
;
stream
<<
" "
;
if
(
!
location
.
arguments_
[
arg_n
].
assign_to_local
(
if
(
!
location
.
arguments_
[
arg_n
].
assign_to_local
(
stream
,
"result"
,
stream
,
"result"
,
bin_path_
,
pid
))
bin_path_
,
pid
))
return
false
;
return
false
;
stream
<<
"
\n
"
;
stream
<<
"
\n
"
;
}
else
{
}
else
{
...
@@ -205,8 +206,8 @@ bool Probe::usdt_getarg(std::ostream &stream, const optional<int> &pid) {
...
@@ -205,8 +206,8 @@ bool Probe::usdt_getarg(std::ostream &stream, const optional<int> &pid) {
return
false
;
return
false
;
tfm
::
format
(
stream
,
" case 0x%xULL: "
,
global_address
);
tfm
::
format
(
stream
,
" case 0x%xULL: "
,
global_address
);
if
(
!
location
.
arguments_
[
arg_n
].
assign_to_local
(
if
(
!
location
.
arguments_
[
arg_n
].
assign_to_local
(
stream
,
"result"
,
stream
,
"result"
,
bin_path_
,
pid
))
bin_path_
,
pid
))
return
false
;
return
false
;
stream
<<
" break;
\n
"
;
stream
<<
" break;
\n
"
;
...
@@ -282,7 +283,8 @@ bool Context::generate_usdt_args(std::ostream &stream) {
...
@@ -282,7 +283,8 @@ bool Context::generate_usdt_args(std::ostream &stream) {
return
true
;
return
true
;
}
}
bool
Context
::
enable_probe
(
const
std
::
string
&
probe_name
,
const
std
::
string
&
fn_name
)
{
bool
Context
::
enable_probe
(
const
std
::
string
&
probe_name
,
const
std
::
string
&
fn_name
)
{
Probe
*
p
=
get
(
probe_name
);
Probe
*
p
=
get
(
probe_name
);
if
(
!
p
)
if
(
!
p
)
return
false
;
return
false
;
...
@@ -299,10 +301,7 @@ bool Context::enable_probe(const std::string &probe_name, const std::string &fn_
...
@@ -299,10 +301,7 @@ bool Context::enable_probe(const std::string &probe_name, const std::string &fn_
void
Context
::
each_uprobe
(
each_uprobe_cb
callback
)
{
void
Context
::
each_uprobe
(
each_uprobe_cb
callback
)
{
for
(
auto
&
p
:
uprobes_
)
{
for
(
auto
&
p
:
uprobes_
)
{
for
(
Probe
::
Location
&
loc
:
p
.
first
->
locations_
)
{
for
(
Probe
::
Location
&
loc
:
p
.
first
->
locations_
)
{
callback
(
callback
(
p
.
first
->
bin_path_
.
c_str
(),
p
.
second
.
c_str
(),
loc
.
address_
,
p
.
first
->
bin_path_
.
c_str
(),
p
.
second
.
c_str
(),
loc
.
address_
,
pid_
.
value_or
(
-
1
));
pid_
.
value_or
(
-
1
));
}
}
}
}
...
@@ -328,7 +327,6 @@ Context::~Context() {
...
@@ -328,7 +327,6 @@ Context::~Context() {
delete
p
;
delete
p
;
}
}
}
}
}
}
extern
"C"
{
extern
"C"
{
...
@@ -357,7 +355,8 @@ void bcc_usdt_close(void *usdt) {
...
@@ -357,7 +355,8 @@ void bcc_usdt_close(void *usdt) {
delete
ctx
;
delete
ctx
;
}
}
int
bcc_usdt_enable_probe
(
void
*
usdt
,
const
char
*
probe_name
,
const
char
*
fn_name
)
{
int
bcc_usdt_enable_probe
(
void
*
usdt
,
const
char
*
probe_name
,
const
char
*
fn_name
)
{
USDT
::
Context
*
ctx
=
static_cast
<
USDT
::
Context
*>
(
usdt
);
USDT
::
Context
*
ctx
=
static_cast
<
USDT
::
Context
*>
(
usdt
);
return
ctx
->
enable_probe
(
probe_name
,
fn_name
)
?
0
:
-
1
;
return
ctx
->
enable_probe
(
probe_name
,
fn_name
)
?
0
:
-
1
;
}
}
...
@@ -374,5 +373,4 @@ void bcc_usdt_foreach_uprobe(void *usdt, bcc_usdt_uprobe_cb callback) {
...
@@ -374,5 +373,4 @@ void bcc_usdt_foreach_uprobe(void *usdt, bcc_usdt_uprobe_cb callback) {
USDT
::
Context
*
ctx
=
static_cast
<
USDT
::
Context
*>
(
usdt
);
USDT
::
Context
*
ctx
=
static_cast
<
USDT
::
Context
*>
(
usdt
);
ctx
->
each_uprobe
(
callback
);
ctx
->
each_uprobe
(
callback
);
}
}
}
}
src/cc/usdt.h
View file @
1a2ddac2
...
@@ -134,7 +134,8 @@ class Probe {
...
@@ -134,7 +134,8 @@ class Probe {
std
::
string
largest_arg_type
(
size_t
arg_n
);
std
::
string
largest_arg_type
(
size_t
arg_n
);
bool
add_to_semaphore
(
int
pid
,
int16_t
val
);
bool
add_to_semaphore
(
int
pid
,
int16_t
val
);
bool
resolve_global_address
(
uint64_t
*
global
,
const
uint64_t
addr
,
optional
<
int
>
pid
);
bool
resolve_global_address
(
uint64_t
*
global
,
const
uint64_t
addr
,
optional
<
int
>
pid
);
bool
lookup_semaphore_addr
(
uint64_t
*
address
,
int
pid
);
bool
lookup_semaphore_addr
(
uint64_t
*
address
,
int
pid
);
void
add_location
(
uint64_t
addr
,
const
char
*
fmt
);
void
add_location
(
uint64_t
addr
,
const
char
*
fmt
);
...
@@ -156,7 +157,6 @@ public:
...
@@ -156,7 +157,6 @@ public:
bool
disable
(
int
pid
);
bool
disable
(
int
pid
);
bool
enabled
()
const
{
return
!
enabled_semaphores_
.
empty
();
}
bool
enabled
()
const
{
return
!
enabled_semaphores_
.
empty
();
}
bool
in_shared_object
();
bool
in_shared_object
();
const
std
::
string
&
name
()
{
return
name_
;
}
const
std
::
string
&
name
()
{
return
name_
;
}
const
std
::
string
&
bin_path
()
{
return
bin_path_
;
}
const
std
::
string
&
bin_path
()
{
return
bin_path_
;
}
...
...
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