Last active
May 22, 2023 11:32
-
-
Save x746e/66ded1066a310a880f8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To print a str variable. | |
x/s ((PyStringObject*)str_var)->ob_sval | |
define ppstr | |
printf "%s\n", ((PyStringObject*)$arg0)->ob_sval | |
end | |
define ppr | |
printf "%s\n", ((PyStringObject*)PyObject_Repr($arg0))->ob_sval | |
end | |
# Print whole string. | |
printf "%s\n", str_var | |
# Print dict. | |
printf "%s\n", ((PyStringObject*)dict_repr((PyDictObject*)dict_var))->ob_sval | |
# Print dict's keys | |
printf "%s\n", ((PyStringObject*)list_repr((PyListObject*)((PyListObject*)PyDict_Keys((PyDictObject*)dict_var))))->ob_sval | |
# Print list. | |
printf "%s\n", ((PyStringObject*)list_repr((PyListObject*)list_var))->ob_sval | |
# Contents of a module (module dict) | |
printf "%s\n", ((PyStringObject*)dict_repr((PyDictObject*)(((PyModuleObject*)module)->md_dict)))->ob_sval | |
# Variable names in a module (module dict's keys) | |
printf "%s\n", ((PyStringObject*)list_repr((PyListObject*)((PyListObject*)PyDict_Keys((PyDictObject*)(((PyModuleObject*)module)->md_dict)))))->ob_sval |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment