This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Option parsing in gdb python
> The part that I don't get at the moment is how this is all going to be useful in general. Can you give some example of how you want to use this class?
Oh, sorry. I have an image class, and I want to support
show image img
but I also want to specify the format width, the part of the image to show, etc. So
show image -a img # print it all
show image -o 10 20 img 5 5 # print the 5x5 subimage starting at (10, 20)
show image -o 10 20 -c img 5 5 # print the 5x5 subimage centred at (10, 20)
show image -f 4 -a img # print it all, using a field width of 4 chars
That last one looks like:
> (gdb) show image -f 4 -a idImage
> 0 1 2 3 4 5 6 7 8 9 10 11
> 7 0x0 0x0 0x0 0x3 0x0 0x0 0x0 0x0 0x2 0x2 0x0 0x0
> 6 0x0 0x0 0x3 0x3 0x3 0x0 0x0 0x2 0x2 0x2 0x2 0x0
> 5 0x0 0x0 0x0 0x3 0x0 0x0 0x2 0x2 0x2 0x2 0x2 0x2
> 4 0x0 0x0 0x0 0x0 0x1 0x0 0x0 0x2 0x2 0x0 0x2 0x0
> 3 0x0 0x0 0x0 0x1 0x1 0x1 0x0 0x0 0x0 0x0 0x0 0x0
> 2 0x0 0x0 0x1 0x1 0x1 0x1 0x1 0x0 0x0 0x0 0x0 0x0
> 1 0x0 0x0 0x0 0x1 0x1 0x1 0x0 0x0 0x0 0x0 0x0 0x0
> 0 0x0 0x0 0x0 0x0 0x1 0x0 0x0 0x0 0x0 0x0 0x0 0x0
I also have similar needs for eigen::Matrix, and ...
So I call GdbArgumentParse in the invoke method of a subclass of gdb.Command.
R