| 504 | } |
| 505 | |
| 506 | Object::Object(const std::shared_ptr<const AbstractProcessManager>& manager, remote_addr_t addr) |
| 507 | : d_addr(addr) |
| 508 | , d_type_addr(0) |
| 509 | , d_classname() |
| 510 | , d_flags() |
| 511 | , d_manager(manager) |
| 512 | { |
| 513 | LOG(DEBUG) << std::hex << std::showbase << "Copying PyObject data from address " << addr; |
| 514 | |
| 515 | Structure<py_object_v> obj(manager, addr); |
| 516 | try { |
| 517 | obj.copyFromRemote(); |
| 518 | } catch (RemoteMemCopyError& ex) { |
| 519 | LOG(WARNING) << std::hex << std::showbase << "Failed to read PyObject data from address " |
| 520 | << d_addr; |
| 521 | d_classname = "invalid object"; |
| 522 | return; |
| 523 | } |
| 524 | |
| 525 | d_type_addr = obj.getField(&py_object_v::o_ob_type); |
| 526 | LOG(DEBUG) << std::hex << std::showbase << "Copying typeobject from address " << d_type_addr; |
| 527 | Structure<py_type_v> cls(manager, d_type_addr); |
| 528 | try { |
| 529 | d_flags = cls.getField(&py_type_v::o_tp_flags); |
| 530 | } catch (RemoteMemCopyError& ex) { |
| 531 | LOG(WARNING) << std::hex << std::showbase << "Failed to read typeobject from address " |
| 532 | << d_type_addr; |
| 533 | d_classname = "invalid object"; |
| 534 | return; |
| 535 | } |
| 536 | |
| 537 | remote_addr_t name_addr = cls.getField(&py_type_v::o_tp_name); |
| 538 | try { |
| 539 | d_classname = manager->getCStringFromAddress(name_addr); |
| 540 | } catch (RemoteMemCopyError& ex) { |
| 541 | // If the original ELF files are not available, we can try to guess the class |
| 542 | // name from other available information, specially for the types where the |
| 543 | // class name is needed to categorize then. |
| 544 | d_classname = guessClassName(cls); |
| 545 | } |
| 546 | LOG(DEBUG) << "Object class resolved to: " << d_classname; |
| 547 | } |
| 548 | |
| 549 | bool |
| 550 | Object::hasFlags(unsigned long flags) const |
nothing calls this directly
no test coverage detected