diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2016-03-10 17:12:30 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2016-03-10 17:12:30 -0500 |
commit | f2f3ccb9f81255fd1b4f877600f39979c2d7ece5 (patch) | |
tree | b716861822a8b7ecd3d643061903298d57b969b8 /gdb/data-directory | |
parent | a9f02af88d230aabf6771f94a6c401727a865188 (diff) | |
download | gdb-f2f3ccb9f81255fd1b4f877600f39979c2d7ece5.zip gdb-f2f3ccb9f81255fd1b4f877600f39979c2d7ece5.tar.gz gdb-f2f3ccb9f81255fd1b4f877600f39979c2d7ece5.tar.bz2 |
Add $_as_string convenience function
This patch is a follow-up to "Add printf format specifier for printing
enumerator":
https://sourceware.org/ml/gdb-patches/2016-02/msg00144.html
Instead of having a solution specific to the printf command, Pedro
suggested adding a general purpose function $_as_string() that would
cover this use case and more.
So, in order to print the textual label of an enum, one can use:
(gdb) printf "Visiting node of type %s\n", $_as_string(node)
Visiting node of type NODE_INTEGER
gdb/ChangeLog:
* data-directory/Makefile.in (PYTHON_FILE_LIST): Install
gdb/function/as_string.py.
* python/lib/gdb/function/as_string.py: New file.
* NEWS: Mention the new $_as_string function.
gdb/testsuite/ChangeLog:
* gdb.python/py-as-string.exp: New file.
* gdb.python/py-as-string.c: New file.
gdb/doc/ChangeLog:
* gdb.texinfo (Convenience Functions): Document $_as_string.
Diffstat (limited to 'gdb/data-directory')
-rw-r--r-- | gdb/data-directory/Makefile.in | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in index f6d959f..c05f379 100644 --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in @@ -74,6 +74,7 @@ PYTHON_FILE_LIST = \ gdb/command/prompt.py \ gdb/command/explore.py \ gdb/function/__init__.py \ + gdb/function/as_string.py \ gdb/function/caller_is.py \ gdb/function/strfns.py \ gdb/printer/__init__.py \ |