This is the mail archive of the mailing list for the GDB 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: [PATCH] Remove unwanted spaces when looking up builtin types

On Wed, Oct 29, 2014 at 11:50 AM, Siva Chandra <> wrote:
> Currently, if we do something like gdb.lookup_type(" unsigned long "),
> GDB errors out because of the leading and trailing spaces.  The
> attached patch fixes this problem.
> A practical situation where this problem is hit is when invoking
> template methods. Its not uncommon to do things like this:
> (gdb) p< unsigned long >()
> If "bar" happens to be an xmethod, then its implementation will
> typically need to parse the name of the method ("bar< unsigned long >"
> in the above example) to get the template argument and lookup the
> type. GDB currently fails for such cases. One could of course
> sanitize/fix such inputs in Python before calling lookup_type, but I
> think it is better done on the GDB side as having white spaces is
> valid syntax.

This is still relevant, but required a rebase over the recent changes
to language.c.

2015-01-06  Siva Chandra Reddy  <>


        * language.c (language_lookup_primitive_type_1): Remove
        unwanted space in the type name before looking it up.
        (whitespace_p): New function.


        * gdb.python/py-type.exp: Add new tests.

Attachment: unwanted_space_v2.txt
Description: Text document

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