Feature request
When we generate debug info for a module using .add_debug_info, updating it later, for example, to add a scope field to a DILocalVariable that was initially created with partial data, isn’t straightforward. The current workaround involves manually fetching the underlying tuple for that field, modifying it, and replacing it. It would be much cleaner if native functions existed to update such fields directly.
For example:
# Current workaround
var = module.add_debug_info("DILocalVariable", {
"name": "ctx",
"arg": 1,
"file": module._file_metadata,
"type": some_type
})
# Later we realize we need to add a scope
existing_operands = list(var.operands)
existing_operands.append(("scope", scope_value))
var.operands = tuple(existing_operands)
Ideally, this could instead be done through a helper like:
var.add_debug_info_field("scope", scope_value)
This would make the API safer and more maintainable.
Feature request
When we generate debug info for a module using
.add_debug_info, updating it later, for example, to add ascopefield to aDILocalVariablethat was initially created with partial data, isn’t straightforward. The current workaround involves manually fetching the underlying tuple for that field, modifying it, and replacing it. It would be much cleaner if native functions existed to update such fields directly.For example:
Ideally, this could instead be done through a helper like:
This would make the API safer and more maintainable.