Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add printer format (like /x) in DUEL #8

Open
jreybert opened this issue Feb 9, 2018 · 5 comments
Open

Add printer format (like /x) in DUEL #8

jreybert opened this issue Feb 9, 2018 · 5 comments

Comments

@jreybert
Copy link

jreybert commented Feb 9, 2018

IMO, there is a fundamental printing behavior missing here, the support of print format:

FMT is a repeat count followed by a format letter and a size letter.
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
t(binary), f(float), a(address), i(instruction), c(char), s(string)
and z(hex, zero padded on the left).
Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).
The specified number of objects of the specified size are printed
according to the format.

Anyway, I can't wait the next bug to really test DUEL, thanks!

@vuvova
Copy link
Owner

vuvova commented Feb 10, 2018

I'm not quite sure how to fit it into the language. In duel one can easily print many values of different types, like

(gdb) dl 1,2.0,"foo"

or, more practical

(gdb) dl root-->next->(id, name)

So, may be something like

(gdb) dl root-->next->(id //x , name //s)

But if it's an operator, then it's not very clear what its precedence and how it applies to expressions, for example:

(gdb) dl root-->next->(id , name) //x

or even

(gdb) dl root-->next//x->(id , name)

@jreybert
Copy link
Author

jreybert commented Nov 8, 2019

Any news about this enhancement?

Today, gdb does not care about the granularity of /x operator: it's all members.

At least, such simple granularity is at least necessary in my point of view: I can't easily use dl to review a bunch of pointers. If you are able to define and implement a per-memeber operator, it would be a real plus.

Can I help you in something? If you don't have time to implement this, I can try to do a PR, but I have to dive into your the source code, and I certainly will need your support.

@vuvova
Copy link
Owner

vuvova commented Nov 10, 2019

Thanks. It's not a question of time, it, probably, wouldn't need much time to implement.

It's just that I don't understand how to fit the concept of these /x formats into duel.

Simple dl/x can be implemented quickly, though. /x is parsed in the invoke method in __init__.py and it should set some kind of a flag that val2str will use to print pointers as you like it.

@jreybert
Copy link
Author

I tried to dive into your parser, but I start from too far, and I don't really understand where I from where to start. Any hint on how to add a new parser entry?

@vuvova
Copy link
Owner

vuvova commented Nov 14, 2019

There is no need to modify the parser as such. I'd do something like

  if arg.startswith("/x"):
    hex_mode=True
    arg=arg[2:]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants