This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Python pretty-printed output isn't pretty :-(


Paul> My attempt to fix this (attached at the end) didn't improve things
Paul> that much:

Paul> (gdb) p foo
Paul> $3 = {mis = 
Paul> std::map with 5 elements, [0] = 0x406068 "/home/ppluzhnikov/src/tmp/simple-stl2", [1] = 0x406188 "foe", [2] = 0x406268 "fi", [3] = 0x406348 "fu", [4] = 0x406428 "fum", msi = 
Paul> std::map with 5 elements, [0x4060b8 "/home/ppluzhnikov/src/tmp/simple-stl2"] = 0, [0x406298 "fi"] = 2, [0x4061b8 "foe"] = 1, [0x406378 "fu"] = 3, [0x406458 "fum"] = 4}

Why do we get a newline after "mis ="?

Otherwise this looks reasonable-ish ... your second example was nicer,
but the extras are just a bit more code in _format_children.

Paul> But I don't see how Python pretty printer could cooperate with
Paul> wrap_here().  It could pay attention to width though.

As an aside, I'm not very fond of wrap_here.  For one thing, its state
is global -- but it seems to me that it really ought to be per-stream.

Right now we have a hack to make things print "nicely", but this hack
more or less assumes "set print pretty on", since I didn't want to
mess with passing a bunch more info to pretty-printers.

Now that all CLI output goes through _format_children, perhaps we
could reconsider this.  We can pass it whatever arguments we like.
So, we could pass it 'recurse' so that it can know about the depth at
least.  And, we could do the actual printing from _format_children
rather than returning a string.

We'd probably also need a way to wrap a ui_file, but we'll want that
anyhow.

What do you think of that?


Another (extreme) solution would be to disable pretty-printing unless
"set print pretty" is set.  I'm not super fond of this.

On a related note, I have been thinking that perhaps we need to rename
this feature, since "pretty printing" already has a meaning in gdb.
Perhaps "visualizing".


Also, I've been wondering if we want to drop the address when we print
a std::string.  To me it is just noise.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]