diff options
| author | Andrew Burgess <aburgess@redhat.com> | 2026-02-22 17:37:34 +0000 |
|---|---|---|
| committer | Andrew Burgess <aburgess@redhat.com> | 2026-03-05 10:17:08 +0000 |
| commit | 030f56e0e82cd98f52a4afa468e6612d3454c57f (patch) | |
| tree | 366a7efed483c5bd6daf6b76648ee3138cf890e9 /zlib/contrib/pascal/example.pas | |
| parent | 8012cfca41d9379e436a404d21c00df0ea126d28 (diff) | |
| download | fsf-binutils-gdb-master.zip fsf-binutils-gdb-master.tar.gz fsf-binutils-gdb-master.tar.bz2 | |
This commit adds a new method gdb.Symtab.source_lines. This method
can be used to read the lines from a symtab's source file. This is
similar to GDB's internal source_cache::get_source_lines function.
Currently using the Python API, if a user wants to display source
lines then they need to use Symtab.fullname() to get the source file
name, then open this file and parse out the lines themselves.
This isn't too much effort, but the problem is that these lines will
not be styled. The user could style the source content themselves,
but will this be styled exactly as GDB would style it?
The new Symtab.source_lines() method returns source lines with styling
included (as ANSI terminal escape sequences), assuming of course, that
styling is currently enabled.
Of course, in some cases, a user of the Python API might want source
code without styling. That's supported too, the new method has an
'unstyled' argument. If this is True then the output is forced to be
unstyled. The argument is named 'unstyled' rather than 'styled'
because the API call cannot force styling on. If 'set style enabled
off' is in effect then making the API call will never return styled
source lines.
The new API call allows for a range of lines to be requested if
desired.
As part of this commit I've updated the host_string_to_python_string
utility function to take a std::string_view.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'zlib/contrib/pascal/example.pas')
0 files changed, 0 insertions, 0 deletions
