PalmBinaryFile.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2000-2001, The University of Queensland
00003  *
00004  * See the file "LICENSE.TERMS" for information on usage and
00005  * redistribution of this file, and for a DISCLAIMER OF ALL
00006  * WARRANTIES.
00007  *
00008  */
00009 
00010 /* File: PalmBinaryFile.h
00011  * Desc: This file contains the definition of the class PalmBinaryFile.
00012 */
00013 
00014 /* $Revision: 1.7 $
00015  * 02 Feb 2000 - Mike: Initial revision
00016  * 01 Aug 01 - Mike: GetGlobalPointerInfo() returns unsigned ints now
00017 */
00018 
00019 #ifndef __PALMBINARYFILE_H__
00020 #define __PALMBINARYFILE_H__
00021 
00022 /*==============================================================================
00023  * Dependencies.
00024  *============================================================================*/
00025 
00026 #include "BinaryFile.h"
00027 
00028 class PalmBinaryFile : public BinaryFile
00029 {
00030 public:
00031                 PalmBinaryFile();               // Constructor
00032   virtual       ~PalmBinaryFile();
00033   virtual void  UnLoad();                       // Unload the image
00034   virtual bool  Open(const char* sName);        // Open the file for r/w; pv
00035   virtual void  Close();                        // Close file opened with Open()
00036   virtual bool  PostLoad(void* handle);         // For archive files only
00037   virtual LOAD_FMT GetFormat() const;           // Get format i.e. LOADFMT_PALM
00038   virtual MACHINE GetMachine() const;           // Get machine i.e. MACHINE_PALM
00039   virtual const char *getFilename() const { return m_pFileName; }
00040 
00041   virtual bool isLibrary() const;
00042   virtual std::list<const char *> getDependencyList();
00043   virtual ADDRESS getImageBase();
00044   virtual size_t getImageSize();
00045 
00046         // Get a symbol given an address
00047         const char* SymbolByAddress(ADDRESS dwAddr);
00048         // Return true if the address matches the convention for A-line system calls
00049         bool        IsDynamicLinkedProc(ADDRESS uNative);
00050 
00051 // Specific to BinaryFile objects that implement a "global pointer"
00052 // Gets a pair of unsigned integers representing the address of %agp (first) and the value for GLOBALOFFSET (second)
00053 virtual std::pair<unsigned,unsigned> GetGlobalPointerInfo();
00054 
00055 // Palm specific calls
00056   
00057   // Get the ID number for this application. It's possible that the app uses
00058   // this number internally, so this needs to be used in the final make
00059   int           GetAppID() const;
00060 
00061   // Generate binary files for non code and data sections
00062   void          GenerateBinFiles(const std::string& path) const;
00063 
00064 //
00065 //  --  --  --  --  --  --  --  --  --  --  --
00066 //
00067 // Internal information
00068 // Dump headers, etc
00069 //virtual bool    DisplayDetails(const char* fileName, FILE* f = stdout);
00070 
00071 
00072     // Analysis functions
00073     virtual std::list<SectionInfo*>& GetEntryPoints(const char* pEntry = "main");
00074     virtual ADDRESS GetMainEntryPoint();
00075     virtual ADDRESS GetEntryPoint();
00076 
00077 //    bool        IsDynamicLinkedProc(ADDRESS wNative);
00078 //    ADDRESS     NativeToHostAddress(ADDRESS uNative);
00079 
00080   protected:
00081     virtual bool  RealLoad(const char* sName); // Load the file; pure virtual
00082 
00083   private:
00084     unsigned char* m_pImage;                       // Points to loaded image
00085     unsigned char* m_pData;                        // Points to data
00086     // Offset from start of data to where a5 should be initialised to   
00087     unsigned int   m_SizeBelowA5;
00088     const char *   m_pFileName;
00089 };
00090 
00091 #endif      // #ifndef __PALMBINARYFILE_H__

Generated on Tue Sep 19 21:18:25 2006 for Boomerang by  doxygen 1.4.6