-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
script: Support native C/C++ shared object scripting #1205
base: master
Are you sure you want to change the base?
Changes from 1 commit
441a52b
3ca3c9a
04ae7b5
94b9169
34aca70
5b8ae2f
63354f6
5cfe799
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -572,6 +572,9 @@ int python_uftrace_begin(struct uftrace_script_info *info) | |
PyObject *ctx; | ||
int i; | ||
char *s; | ||
struct strv sv = { | ||
0, | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
|
||
if (unlikely(!pFuncBegin)) | ||
return -1; | ||
|
@@ -582,9 +585,12 @@ int python_uftrace_begin(struct uftrace_script_info *info) | |
insert_dict_bool(dict, "record", info->record); | ||
insert_dict_string(dict, "version", info->version); | ||
|
||
cmds = __PyTuple_New(info->cmds.nr); | ||
if (info->cmds) | ||
strv_split(&sv, info->cmds, "\n"); | ||
|
||
cmds = __PyTuple_New(sv.nr); | ||
|
||
strv_for_each(&info->cmds, s, i) | ||
strv_for_each(&sv, s, i) | ||
insert_tuple_string(cmds, i, s); | ||
|
||
__PyDict_SetItemString(dict, "cmds", cmds); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ struct uftrace_script_info { | |
char *name; | ||
char *version; | ||
bool record; | ||
struct strv cmds; | ||
const char *cmds; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not expose this to users. Native scripts can have a separate header with your change. Maybe argc + argv[] are more appropriate for native scripts. |
||
}; | ||
|
||
/* context information passed to script */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
STRV_INIT
.