Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
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
bpftrace
Commits
e8b99cd2
Commit
e8b99cd2
authored
Jan 17, 2019
by
williangaspar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes:
https://github.com/iovisor/bpftrace/issues/344
parent
e73f69c9
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
11 deletions
+18
-11
src/ast/ast.h
src/ast/ast.h
+8
-1
src/ast/codegen_llvm.cpp
src/ast/codegen_llvm.cpp
+1
-1
src/ast/semantic_analyser.cpp
src/ast/semantic_analyser.cpp
+2
-2
src/bpftrace.cpp
src/bpftrace.cpp
+2
-2
src/lexer.l
src/lexer.l
+1
-1
src/mapkey.cpp
src/mapkey.cpp
+1
-1
src/printf.cpp
src/printf.cpp
+1
-1
src/types.cpp
src/types.cpp
+1
-1
src/types.h
src/types.h
+1
-1
No files found.
src/ast/ast.h
View file @
e8b99cd2
#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <map>
...
...
@@ -56,7 +57,13 @@ public:
class
Builtin
:
public
Expression
{
public:
explicit
Builtin
(
std
::
string
ident
)
:
ident
(
ident
)
{
}
explicit
Builtin
(
std
::
string
ident
)
:
ident
(
ident
)
{
if
(
ident
==
"stack"
)
{
std
::
cout
<<
"
\033
[33m warning:
\033
[0m"
;
std
::
cout
<<
"stack is deprecated and will be removed in the future. Use kstack instead"
<<
std
::
endl
;
this
->
ident
=
"kstack"
;
}
}
std
::
string
ident
;
int
probe_id
;
...
...
src/ast/codegen_llvm.cpp
View file @
e8b99cd2
...
...
@@ -49,7 +49,7 @@ void CodegenLLVM::visit(Builtin &builtin)
{
expr_
=
b_
.
CreateGetNs
();
}
else
if
(
builtin
.
ident
==
"stack"
||
builtin
.
ident
==
"ustack"
)
else
if
(
builtin
.
ident
==
"
k
stack"
||
builtin
.
ident
==
"ustack"
)
{
Value
*
stackid
=
b_
.
CreateGetStackId
(
ctx_
,
builtin
.
ident
==
"ustack"
);
// Kernel stacks should not be differentiated by tid, since the kernel
...
...
src/ast/semantic_analyser.cpp
View file @
e8b99cd2
...
...
@@ -60,8 +60,8 @@ void SemanticAnalyser::visit(Builtin &builtin)
builtin
.
ident
==
"retval"
)
{
builtin
.
type
=
SizedType
(
Type
::
integer
,
8
);
}
else
if
(
builtin
.
ident
==
"stack"
)
{
builtin
.
type
=
SizedType
(
Type
::
stack
,
8
);
else
if
(
builtin
.
ident
==
"
k
stack"
)
{
builtin
.
type
=
SizedType
(
Type
::
k
stack
,
8
);
needs_stackid_map_
=
true
;
}
else
if
(
builtin
.
ident
==
"ustack"
)
{
...
...
src/bpftrace.cpp
View file @
e8b99cd2
...
...
@@ -423,7 +423,7 @@ std::vector<std::unique_ptr<IPrintable>> BPFtrace::get_arg_values(const std::vec
resolve_probe
(
*
reinterpret_cast
<
uint64_t
*>
(
arg_data
+
arg
.
offset
))));
break
;
case
Type
:
:
stack
:
case
Type
:
:
k
stack
:
arg_values
.
push_back
(
std
::
make_unique
<
PrintableString
>
(
get_stack
(
...
...
@@ -881,7 +881,7 @@ int BPFtrace::print_map(IMap &map, uint32_t top, uint32_t div)
std
::
cout
<<
map
.
name_
<<
map
.
key_
.
argument_value_list
(
*
this
,
key
)
<<
": "
;
if
(
map
.
type_
.
type
==
Type
::
stack
)
if
(
map
.
type_
.
type
==
Type
::
k
stack
)
std
::
cout
<<
get_stack
(
*
(
uint64_t
*
)
value
.
data
(),
false
,
8
);
else
if
(
map
.
type_
.
type
==
Type
::
ustack
)
std
::
cout
<<
get_stack
(
*
(
uint64_t
*
)
value
.
data
(),
true
,
8
);
...
...
src/lexer.l
View file @
e8b99cd2
...
...
@@ -49,7 +49,7 @@ path :(\\.|[_\-\./a-zA-Z0-9])*:
<COMMENT>"*/" BEGIN(INITIAL);
<COMMENT>"EOF" driver.error(loc, std::string("end of file during comment"));
pid|tid|cgroup|uid|gid|nsecs|cpu|comm|stack|ustack|arg[0-9]|retval|func|probe|curtask|rand|ctx|username|args {
pid|tid|cgroup|uid|gid|nsecs|cpu|comm|
kstack|
stack|ustack|arg[0-9]|retval|func|probe|curtask|rand|ctx|username|args {
return Parser::make_BUILTIN(yytext, loc); }
{path} { return Parser::make_PATH(yytext, loc); }
{map} { return Parser::make_MAP(yytext, loc); }
...
...
src/mapkey.cpp
View file @
e8b99cd2
...
...
@@ -71,7 +71,7 @@ std::string MapKey::argument_value(BPFtrace &bpftrace,
return
std
::
to_string
(
*
(
int64_t
*
)
data
);
break
;
}
case
Type
:
:
stack
:
case
Type
:
:
k
stack
:
return
bpftrace
.
get_stack
(
*
(
uint64_t
*
)
data
,
false
);
case
Type
:
:
ustack
:
return
bpftrace
.
get_stack
(
*
(
uint64_t
*
)
data
,
true
);
...
...
src/printf.cpp
View file @
e8b99cd2
...
...
@@ -34,7 +34,7 @@ std::string verify_format_string(const std::string &fmt, std::vector<Field> args
{
Type
arg_type
=
args
.
at
(
i
).
type
.
type
;
if
(
arg_type
==
Type
::
sym
||
arg_type
==
Type
::
usym
||
arg_type
==
Type
::
probe
||
arg_type
==
Type
::
username
||
arg_type
==
Type
::
stack
||
arg_type
==
Type
::
ustack
||
arg_type
==
Type
::
username
||
arg_type
==
Type
::
k
stack
||
arg_type
==
Type
::
ustack
||
arg_type
==
Type
::
inet
)
arg_type
=
Type
::
string
;
// Symbols should be printed as strings
int
offset
=
1
;
...
...
src/types.cpp
View file @
e8b99cd2
...
...
@@ -43,7 +43,7 @@ std::string typestr(Type t)
case
Type
:
:
max
:
return
"max"
;
break
;
case
Type
:
:
avg
:
return
"avg"
;
break
;
case
Type
:
:
stats
:
return
"stats"
;
break
;
case
Type
:
:
stack
:
return
"
stack"
;
break
;
case
Type
:
:
kstack
:
return
"k
stack"
;
break
;
case
Type
:
:
ustack
:
return
"ustack"
;
break
;
case
Type
:
:
string
:
return
"string"
;
break
;
case
Type
:
:
sym
:
return
"sym"
;
break
;
...
...
src/types.h
View file @
e8b99cd2
...
...
@@ -24,7 +24,7 @@ enum class Type
max
,
avg
,
stats
,
stack
,
k
stack
,
ustack
,
string
,
sym
,
...
...
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