(
entry: &gimli::write::ConvertUnitEntry<Reader<'_>>,
param_num: isize,
)
| 315 | } |
| 316 | |
| 317 | fn is_obj_ptr_param( |
| 318 | entry: &gimli::write::ConvertUnitEntry<Reader<'_>>, |
| 319 | param_num: isize, |
| 320 | ) -> Result<bool, Error> { |
| 321 | debug_assert_eq!(entry.tag, gimli::DW_TAG_formal_parameter); |
| 322 | let unit = entry.read_unit; |
| 323 | |
| 324 | // This logic was taken loosely from LLDB. It is known |
| 325 | // that it is not fully correct (doesn't handle 'deduced |
| 326 | // this', for example). |
| 327 | // Q: DWARF includes DW_AT_object_pointer as we use it, |
| 328 | // why do we need this heuristic as well? |
| 329 | // A: Declarations do not include DW_AT_object_pointer. |
| 330 | if param_num == 0 |
| 331 | && entry.attr_value(gimli::DW_AT_artificial) == Some(AttributeValue::Flag(true)) |
| 332 | { |
| 333 | // Either this has no name (declarations omit them), or its explicitly "this". |
| 334 | let name = entry.attr_value(gimli::DW_AT_name); |
| 335 | if name.is_none() || unit.attr_string(name.unwrap())?.slice().eq(b"this") { |
| 336 | // Finally, a type check. We expect a pointer. |
| 337 | if let Some(type_attr) = entry.attr_value(gimli::DW_AT_type) { |
| 338 | if let Some(type_die) = resolve_die_ref(unit, &type_attr)? { |
| 339 | return Ok(type_die.tag == gimli::DW_TAG_pointer_type); |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | }; |
| 344 | |
| 345 | return Ok(false); |
| 346 | } |
no test coverage detected