ObjectLoader.h revision 80232dd16c0affb2afae01cde6c94abf23ac1ba8
1/* 2 * Copyright 2012, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef BCC_EXECUTION_ENGINE_OBJECT_LOADER_H 18#define BCC_EXECUTION_ENGINE_OBJECT_LOADER_H 19 20#include <cstddef> 21 22namespace bcc { 23 24class FileBase; 25class ObjectLoaderImpl; 26class SymbolResolverInterface; 27 28class ObjectLoader { 29private: 30 ObjectLoaderImpl *mImpl; 31 32 void *mDebugImage; 33 34 ObjectLoader() : mImpl(NULL), mDebugImage(0) { } 35 36public: 37 // Load from a in-memory object. pName is a descriptive name of this memory. 38 static ObjectLoader *Load(void *pMemStart, size_t pMemSize, const char *pName, 39 SymbolResolverInterface &pResolver, 40 bool pEnableGDBDebug); 41 42 // Load from a file. 43 static ObjectLoader *Load(FileBase &pFile, 44 SymbolResolverInterface &pResolver, 45 bool pEnableGDBDebug); 46 47 void *getSymbolAddress(const char *pName) const; 48 49 ~ObjectLoader(); 50}; 51 52} // namespace bcc 53 54#endif // BCC_EXECUTION_ENGINE_OBJECT_LOADER_H 55