Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

/users/u3/mtikir/PMaCInstrumentor_v1601/src/LineInfoTable.C

Go to the documentation of this file.
00001 #include <SymbolTable.h>
00002 #include <LineInfoTable.h>
00003 #include <XCoffFile.h>
00004 #include <BinaryFile.h>
00005 
00006 LineInfoTable::LineInfoTable(char* ptr,uint32_t s,XCoffFile* xcoff)
00007         : Base(XCoffClassTypes_line_info),
00008           lineInfoPointer(ptr),numOfLineInfos(s),
00009           symbolTable(NULL),xCoffFile(xcoff)
00010 {
00011     if(getXCoffFile()->is64Bit()){
00012         sizeInBytes = numOfLineInfos * Size__64_bit_LineInfoTable_Entry;
00013     } else {
00014         sizeInBytes = numOfLineInfos * Size__32_bit_LineInfoTable_Entry;
00015     }
00016     lineInfos = new LineInfo*[numOfLineInfos];
00017 }
00018 
00019 void LineInfo::print(SymbolTable* symbolTable,uint32_t index){
00020     if(GET(l_lnno)){
00021         PRINT_INFOR("\tLNN [%3d] (lnn %9d)(adr %#llx)",index,GET(l_lnno),GET(l_paddr));
00022     } else {
00023         PRINT_INFOR("\tLNN [%3d] (fcn bgn)(sym %9d)",index,GET(l_symndx));
00024         if(symbolTable){
00025             symbolTable->printSymbol(GET(l_symndx));
00026         }
00027     }
00028 }
00029 
00030 void LineInfoTable::print(){
00031     PRINT_INFOR("LINEINFOTABLE");
00032     PRINT_INFOR("\tCount : %d",numOfLineInfos);
00033 
00034     PRINT_INFOR("\tLines :");
00035     for(uint32_t i = 0;i<numOfLineInfos;i++){
00036         lineInfos[i]->print(symbolTable,i);
00037     }
00038 }
00039 
00040 uint32_t LineInfoTable::read(BinaryInputFile* binaryInputFile){
00041     PRINT_DEBUG("Reading the LineInformation table");
00042 
00043     binaryInputFile->setInPointer(lineInfoPointer);
00044     setFileOffset(binaryInputFile->currentOffset());
00045 
00046     uint32_t currSize = Size__32_bit_LineInfoTable_Entry;
00047     if(getXCoffFile()->is64Bit()){
00048         currSize = Size__64_bit_LineInfoTable_Entry;
00049     }
00050 
00051     uint32_t ret = 0;
00052     for(uint32_t i = 0;i<numOfLineInfos;i++){
00053         if(getXCoffFile()->is64Bit()){
00054             lineInfos[i] = new LineInfo64();
00055         } else {
00056             lineInfos[i] = new LineInfo32();
00057         }
00058         binaryInputFile->copyBytesIterate(lineInfos[i]->charStream(),currSize);
00059         ret += currSize;
00060     }
00061 
00062     ASSERT((sizeInBytes == ret) && "FATAL : Somehow the number of read does not match");
00063 
00064     return sizeInBytes;
00065 }

Generated on Mon Jan 28 11:08:32 2008 for PMaCInstrumentor by doxygen 1.3.5