VirtualBox

Changeset 101828 in vbox for trunk/src


Ignore:
Timestamp:
Nov 5, 2023 1:35:54 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159924
Message:

libs/xpcom: Get rid of unused nsStackFrameUnix.{cpp,h} (disabled using the VBOX pre-processor define), bugref:10545

Location:
trunk/src/libs/xpcom18a4
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/Makefile.kmk

    r101825 r101828  
    595595        xpcom/base/nsID.cpp \
    596596        xpcom/base/nsMemoryImpl.cpp \
    597         xpcom/base/nsTraceRefcntImpl.cpp \
    598         xpcom/base/nsStackFrameUnix.cpp
     597        xpcom/base/nsTraceRefcntImpl.cpp
    599598$(evalcall VBOX_XPCOM_X86,VBox-xpcom-base)
    600599
  • trunk/src/libs/xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp

    r101777 r101828  
    833833#endif
    834834
    835 #if defined(_WIN32) && defined(_M_IX86) // WIN32 x86 stack walking code
    836 #include "nsStackFrameWin.h"
    837835void
    838836nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
    839837{
    840   DumpStackToFile(aStream);
    841 }
    842 
    843 // WIN32 x86 stack walking code
    844 // i386 or PPC Linux stackwalking code or Solaris
    845 #elif (defined(linux) && !defined(VBOX) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
    846 #include "nsStackFrameUnix.h"
    847 void
    848 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
    849 {
    850   DumpStackToFile(aStream);
    851 }
    852 
    853 #elif defined(XP_MAC)
    854 
    855 /**
    856  * Stack walking code for the Mac OS.
    857  */
    858 
    859 #include "gc_fragments.h"
    860 
    861 #include <typeinfo>
    862 
    863 extern "C" {
    864 void MWUnmangle(const char *mangled_name, char *unmangled_name, size_t buffersize);
    865 }
    866 
    867 struct traceback_table {
    868         long zero;
    869         long magic;
    870         long reserved;
    871         long codeSize;
    872         short nameLength;
    873         char name[2];
    874 };
    875 
    876 static char* pc2name(long* pc, char name[], long size)
    877 {
    878         name[0] = '\0';
    879        
    880         // make sure pc is instruction aligned (at least).
    881         if (UInt32(pc) == (UInt32(pc) & 0xFFFFFFFC)) {
    882                 long instructionsToLook = 4096;
    883                 long* instruction = (long*)pc;
    884                
    885                 // look for the traceback table.
    886                 while (instructionsToLook--) {
    887                         if (instruction[0] == 0x4E800020 && instruction[1] == 0x00000000) {
    888                                 traceback_table* tb = (traceback_table*)&instruction[1];
    889                                 memcpy(name, tb->name + 1, --nameLength);
    890                                 name[nameLength] = '\0';
    891                                 break;
    892                         }
    893                         ++instruction;
    894                 }
    895         }
    896        
    897         return name;
    898 }
    899 
    900 struct stack_frame {
    901         stack_frame*    next;                           // savedSP
    902         void*                   savedCR;
    903         void*                   savedLR;
    904         void*                   reserved0;
    905         void*                   reserved1;
    906         void*                   savedTOC;
    907 };
    908 
    909 static asm stack_frame* getStackFrame()
    910 {
    911         mr              r3, sp
    912         blr
    913 }
    914 
    915 NS_COM void
    916 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
    917 {
    918   stack_frame* currentFrame = getStackFrame();    // WalkTheStack's frame.
    919         currentFrame = currentFrame->next;                  // WalkTheStack's caller's frame.
    920         currentFrame = currentFrame->next;              // WalkTheStack's caller's caller's frame.
    921    
    922         while (true) {
    923                 // LR saved at 8(SP) in each frame. subtract 4 to get address of calling instruction.
    924                 void* pc = currentFrame->savedLR;
    925 
    926                 // convert PC to name, unmangle it, and generate source location, if possible.
    927                 static char symbol_name[1024], unmangled_name[1024], file_name[256]; UInt32 file_offset;
    928                
    929         if (GC_address_to_source((char*)pc, symbol_name, file_name, &file_offset)) {
    930                         MWUnmangle(symbol_name, unmangled_name, sizeof(unmangled_name));
    931                 fprintf(aStream, "%s[%s,%ld]\n", unmangled_name, file_name, file_offset);
    932         } else {
    933                     pc2name((long*)pc, symbol_name, sizeof(symbol_name));
    934                         MWUnmangle(symbol_name, unmangled_name, sizeof(unmangled_name));
    935                 fprintf(aStream, "%s(0x%08X)\n", unmangled_name, pc);
    936         }
    937 
    938                 currentFrame = currentFrame->next;
    939                 // the bottom-most frame is marked as pointing to NULL, or is ODD if a 68K transition frame.
    940                 if (currentFrame == NULL || UInt32(currentFrame) & 0x1)
    941                         break;
    942         }
    943 }
    944 
    945 #else // unsupported platform.
    946 
    947 void
    948 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
    949 {
    950838        fprintf(aStream, "write me, dammit!\n");
    951839}
    952 
    953 #endif
    954840
    955841//----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette