descr_templates isn't really constant

Issue #265 open
Lawrence D'Anna
created an issue

descr_templates (in method-signature.m) isn't actually constant.

descr_templates is written to by setup_descr(), line 630 during initialization. It should not be qualified const.

EDIT:

The bug is that descr_templates gets written, not that it's qualified wrong

Comments (11)

  1. Ronald Oussoren repo owner

    The attribute is only changed when the value is not a template, see the test on line 629.

    The templates are intended to be const, changing a template would be a bug that needs to be fixed because the templates are reused to reuse memory usage in common cases.

  2. Ronald Oussoren repo owner

    I'll have to debug to know what's going on here.

    I had expected that this is pure constant data and hence in read-only memory (which would have caused a crash on write), but it looks like the data is in writable memory after all. That's probably due to the pointer value for the type encoding.

  3. Ronald Oussoren repo owner

    I've checked the code and all changes to the structure are guarded by a checking that the structure isn't a template, and therefore the templates shouldn't be changed.

    I've also tried creating a watchpoint, but that fails:

    error: Watchpoint creation failed (addr=0x1015c9c80, size=8192, variable expression='descr_templates').
    error: watch size of 8192 is not supported
    

    This is using LLDB as shipped with Xcode 10.2.

  4. Log in to comment