Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: nomadwolf on April 30, 2016, 06:16:43 am

Title: Debugger Scripts - avoiding template matches
Post by: nomadwolf on April 30, 2016, 06:16:43 am
I'm trying to use the gdb_types script to register a new type, let's say 'foo'
However, I do not want that to match when foo is used within a template type, such as tuple<foo, int, int>

I'm not particularly adept with RegExps, but the scripts that come with C::B would suggest using
[^[:alnum:]_]*foo[^[:alnum:]_]*")
However, that also matches the tuple example above

I essentially don't want to have a < before or a comma after 'foo', which leads me to try
(?<![a-zA-Z0-9<])foo(?![a-zA-Z0-9,])
That doesn't work when I try to use that in the script, but it does work as I expect when I run it through an online RegExp checker (https://regex101.com/).
(i.e. 'foo' should pass, '<foo' shouldn't, nor should 'foo,')

Other option would be
[^a-zA-Z0-9<]+CEID[^a-zA-Z0-9,]+
but that won't match 'foo' by itself.

thoughts & help?
Title: Re: Debugger Scripts - avoiding template matches
Post by: ollydbg on April 30, 2016, 03:47:45 pm
I'm trying to use the gdb_types script to register a new type, let's say 'foo'
...
...
thoughts & help?
Hi, welcome to our forum.
I suggest that you can use "GDB python pretty printer" to do the customized print.
Title: Re: Debugger Scripts - avoiding template matches
Post by: nomadwolf on April 30, 2016, 06:11:31 pm
Hi, welcome to our forum.
I suggest that you can use "GDB python pretty printer" to do the customized print.

Oooh, that is much more better.  Works for locals, function parameters, and sub-types.  Thanks!
Now I just have to learn some basic python...
Title: Re: Debugger Scripts - avoiding template matches
Post by: oBFusCATed on May 01, 2016, 07:28:01 pm
Yep, the original debug scripts will be as soon as I find some time to do it.