MCPcopy Create free account
hub / github.com/beefytech/Beef / ParseEHFrameData

Method ParseEHFrameData

IDEHelper/DbgModule.cpp:4607–4737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4605}
4606
4607void DbgModule::ParseEHFrameData()
4608{
4609 const uint8* data = mEHFrameData;
4610 if (data == NULL)
4611 return;
4612
4613 Dictionary<addr_target, DwCommonFrameDescriptor*> commonFrameDescriptorMap;
4614
4615 while (true)
4616 {
4617 addr_target sectionAddress = (addr_target)(data - mEHFrameData);
4618
4619 int length = GET(int);
4620 if (length == 0)
4621 break;
4622
4623 const uint8* dataEnd = data + length;
4624
4625 int cieID = GET(int);
4626 if (cieID <= 0)
4627 {
4628 BP_ALLOC_T(DwCommonFrameDescriptor);
4629 DwCommonFrameDescriptor* commonFrameDescriptor = mAlloc.Alloc<DwCommonFrameDescriptor>();
4630
4631 char version = GET(char);
4632 const char* augmentation = DataGetString(data);
4633
4634 commonFrameDescriptor->mDbgModule = this;
4635 commonFrameDescriptor->mCodeAlignmentFactor = (int)DecodeULEB128(data);
4636 commonFrameDescriptor->mDataAlignmentFactor = (int)DecodeSLEB128(data);
4637 commonFrameDescriptor->mReturnAddressColumn = (int)DecodeULEB128(data);
4638 commonFrameDescriptor->mAugmentation = augmentation;
4639
4640 if (*augmentation == 'z')
4641 {
4642 ++augmentation;
4643 int augLen = (int)DecodeULEB128(data);
4644 commonFrameDescriptor->mAugmentationLength = augLen;
4645 const uint8* augEnd = data + augLen;
4646 while (*augmentation != '\0')
4647 {
4648 if (*augmentation == 'R')
4649 commonFrameDescriptor->mAddressPointerEncoding = (int) GET(uint8);
4650 else if (*augmentation == 'P')
4651 {
4652 int encodingType = GET(uint8);
4653 BF_ASSERT(encodingType == 0);
4654 commonFrameDescriptor->mLSDARoutine = GET(addr_target);
4655 }
4656 else if (*augmentation == 'L')
4657 commonFrameDescriptor->mLSDAPointerEncodingFDE = GET(uint8);
4658 else if (*augmentation == 'S')
4659 {
4660 // mIsSignalHandler - on return from stack frame, CFA is before next instruction rather than after it
4661 }
4662 else
4663 BF_FATAL("Unknown CIE augmentation");
4664 ++augmentation;

Callers

nothing calls this directly

Calls 5

DecodeULEB128Function · 0.85
DecodeSLEB128Function · 0.85
DwFrameDescriptorClass · 0.85
DataGetStringFunction · 0.70
push_backMethod · 0.45

Tested by

no test coverage detected