This is the mail archive of the 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] StdStringPrinter misleading?

El dom, 29-03-2009 a las 18:07 -0600, Tom Tromey escribiÃ:
> >>>>> "Thiago" == Thiago Jung Bauermann <> writes:
> Tom> Yeah, it may not.  That is a general problem with C++ printers,
> Tom> because the typical C++ object has a bunch of pointers to other
> Tom> objects, which probably will not live in values.
> Thiago> So one can't assign a std::string value to a convenience
> Thiago> variable? or it means that parts of it will be in the inferior
> Thiago> anyway?
> Yeah, if you assign one to a convenience variable, parts of it will
> still live in the inferior.
> We could probably fix this.  One way would be to reuse the existing
> pretty-printers -- instead of printing anything, use them to determine
> what bits needs to be fetched into values on the gdb side.  Then, we
> at least know we will be able to print them in the future.  (This
> change would be non-trivial, though, since it would require some kind
> of hash map of addresses to struct value.)

I don't think fixing this is important, it's just something that came up
in the discussion. I do think that pretty printers should work with
convenience variables, though. But it sounds like they would, anyway.

> Thiago> So perhaps having an optional length argument to the string
> Thiago> method could indeed make life easier in cases like this.
> I was thinking about this problem a bit more this afternoon.  It
> occurred to me that counted strings are reasonably common in user
> code, so we'd want some way to express that, even if we put
> language-specific information (like std::string) into the gdb core.
> Whether this way is value.string or gdb.read_memory, I don't know.
> I lean toward string, but if you have a preference...

I agree, string is more natural.
Thiago Jung Bauermann
IBM Linux Technology Center

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