Comments (3)
This is currently not possible to do; the watch window API needs to be expanded first. Do you have any suggestions on what it should look like?
from gf.
It took me a while to wrap my head around what the current API is attempting to do...my suggestion would be to make it a lot more explicit.
What about something like this:
from typing import Callable
from abc import ABC, abstractmethod
class WatchHook(ABC):
@abstractmethod
def get_short_name(self, expression_value: gdb.Value):
raise NotImplementedError("must override!")
@abstractmethod
def get_row_names(self, expression_value: gdb.Value):
raise NotImplementedError("must override!")
@abstractmethod
def get_row_values(self, expression_value: gdb.Value):
raise NotImplementedError("must override!")
# Sample array hook
class ArrayHook(WatchHook):
def get_short_name(self, array_value: gdb.Value):
# TODO: Extract size of array here
return f"Array of {array_size} items"
def get_row_names(self, array_value: gdb.Value):
"""
This method is called `get_row_names` and not `get_field_names` because
the user can use these for any purpose, for example indices of an array
"""
# TODO: Extract size of array here
self.array_size = array_size
return [str(index) for index in range(0, array_size)]
def get_row_values(self, value_stringify_callback: Callable, array_value: gdb.Value):
result = []
for index in range(self.array_size):
value: gdb.Value = array_value[index]
# This callback will recursively call other registered hooks or the default hook
# to get the string to be displayed
# In the case where array items are structs or other nested objects,
# the callback will insert the short_name here and mark this row as expandable
value_str: str = value_stringify_callback(value)
result.append(value_str)
return result
I don't understand the rest of the gf code enough to actually implement this myself, unfortunately :( I am willing to help though.
from gf.
I've added this in 982176e and documented it in c3aa0fb.
However I have not had a chance to test it much yet, so I'll keep this issue open for now in case there are bugs.
from gf.
Related Issues (20)
- Hidden Files HOT 1
- FreeType Bitmap/Fixed Font Crashes at Startup with "Floating point exception"/Garbled Text HOT 6
- Cannot add breakpoint on future shared library HOT 3
- Print the name of the file I'm debugging in a titlebar (or somewhere) HOT 2
- Incorrect syntax highlighting for multi-line macros
- [feature request] Horizontal scrollbars HOT 4
- Automatic bitmap viewing
- (feature request): add the ability to select and copy text from the code & console output views (i.e., `UICode` elements) HOT 7
- Incorrect syntax highlight for multi-line comments
- Getting GVIM error when running gf2 under WSL2 on Windows 11 HOT 4
- Petition to make the ability to select text for copy/pasting the DEFAULT behavior of gf HOT 7
- Inspect line mode fails to parse variables that contain a number in their name
- feature request: hover to inspect variables.
- Please provide a release version HOT 1
- When trying to use the `[pipe]` feature I get a segfault HOT 1
- GDB `define` command doesn't work HOT 2
- Debugging with multiple inferiors HOT 1
- Error after installing extensions HOT 1
- Show hex value instead of decimal in Locals tab HOT 2
- Support for loading SVD files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gf.