[Lldb-commits] [lldb] r255525 - Make debug info specification use categories system.

Siva Chandra via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 14 14:33:51 PST 2015


On Mon, Dec 14, 2015 at 2:15 PM, Zachary Turner <zturner at google.com> wrote:
> Diff looks like this:
>
> -                @dwarf_test
> -                @wraps(attrvalue)
> -                def dwarf_test_method(self, attrvalue=attrvalue):
> -                    self.debug_info = "dwarf"
> -                    return attrvalue(self)
> -                dwarf_method_name = attrname + "_dwarf"
> -                dwarf_test_method.__name__ = dwarf_method_name
> -                newattrs[dwarf_method_name] = dwarf_test_method
>
> ...
>
> +                for category in supported_categories:
> +                    @add_test_categories([category])
> +                    @wraps(attrvalue)
> +                    def test_method(self, attrvalue=attrvalue):
> +                        self.debug_info = category
> +                        return attrvalue(self)
> +                    method_name = attrname + "_" + category
> +                    test_method.__name__ = method_name
> +                    newattrs[method_name] = test_method
>
>
> So it looks like it's still under a different function.  The difference is
> that before (in the - section of the diff) there were 3 different functions
> with 3 different names.  For example `dwarf_test_method` above.  In the new
> code (+ section of the diff) it looks like one function defined 3 different
> times with the same name `test_method`.  But each of these should be a
> distinct function object that is defined in the context of the closure
> determined by the enclosing scope (the for loop in this case).  So all 3
> functions are actually different.  self is just an argument to the function,
> not some magic value like `this` in C++, so as in the previous version, the
> `debug_info` that gets modified is on whatever instance of `self` gets
> passed into the function, same as before.

I think you are right. I am only basing my theories by feeling the
elephant blind here. When running TestWithLimitDebugInfo, I have
printed the |category| value from test_method and it only prints
"dwo". So, it is |category| which is at fault here as it is the loop
variable. Though two different methods are actually getting added,
self.debug_info refers to the last value of |category|.

> Tamas or Pavel can probably clarify, but that's my understanding.


More information about the lldb-commits mailing list