Back to index

lightning-sunbird  0.9+nobinonly
Functions
gc_fragments.h File Reference
#include <Files.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void GC_register_fragment (char *dataStart, char *dataEnd, char *codeStart, char *codeEnd, const FSSpec *fragmentSpec)
void GC_unregister_fragment (char *dataStart, char *dataEnd, char *codeStart, char *codeEnd)
int GC_address_to_source (char *codeAddr, char symbolName[256], char fileName[256], UInt32 *fileOffset)

Function Documentation

int GC_address_to_source ( char *  codeAddr,
char  symbolName[256],
char  fileName[256],
UInt32 fileOffset 
)

Definition at line 190 of file gc_fragments.cpp.

{
       CodeFragment** link = find_fragment(codeAddr);
       if (link != NULL) {
              CodeFragment* fragment = *link;
              // always move this fragment to the head of the list, to speed up searches.
              if (theFragments != fragment) {
                     *link = fragment->mNext;
                     fragment->mNext = theFragments;
                     theFragments = fragment;
              }
              // see if this is a cached location.
              CodeLocation* location = fragment->mLocations.findLocation(codeAddr);
              if (location != NULL) {
                     ::strcpy(symbolName, location->mSymbolName);
                     ::strcpy(fileName, location->mFileName);
                     *fileOffset = location->mFileOffset;
                     return 1;
              }
              sym_file* symbols = fragment->mSymbols;
              if (symbols != NULL) {
                     if (get_source(symbols, UInt32(codeAddr - fragment->mCodeStart), symbolName, fileName, fileOffset)) {
                            // save this location in the per-fragment cache.
                            fragment->mLocations.saveLocation(codeAddr, symbolName, fileName, *fileOffset);
                            return 1;
                     }
              }
       }
       return 0;
}

Here is the call graph for this function:

void GC_register_fragment ( char *  dataStart,
char *  dataEnd,
char *  codeStart,
char *  codeEnd,
const FSSpec fragmentSpec 
)

Definition at line 156 of file gc_fragments.cpp.

{
       // register the roots.
       GC_add_roots(dataStart, dataEnd);

       // create an entry for this fragment.
       CodeFragment* fragment = new CodeFragment(dataStart, dataEnd,
                                                 codeStart, codeEnd,
                                                 fragmentSpec);
       if (fragment != NULL) {
              fragment->mNext = theFragments;
              theFragments = fragment;
       }
}

Here is the call graph for this function:

void GC_unregister_fragment ( char *  dataStart,
char *  dataEnd,
char *  codeStart,
char *  codeEnd 
)

Definition at line 173 of file gc_fragments.cpp.

{
       // try not to crash when running under the MW debugger.
       if (!AmIBeingMWDebugged()) {
              CodeFragment** link = find_fragment(codeStart);
              if (link != NULL) {
                     CodeFragment* fragment = *link;
                     *link = fragment->mNext;
                     delete fragment;
              }
       }

       // remove the roots.
       GC_remove_roots(dataStart, dataEnd);
}

Here is the call graph for this function: