Changeset 430


Ignore:
Timestamp:
Jan 19, 2017, 7:38:47 AM (9 years ago)
Author:
rlwalsh
Message:

debug: improve handling for Warp 4.5 SYM files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1-0/src/helpers/debug.c

    r384 r430  
    16831683 *@@changed V0.9.3 (2000-04-10) [umoeller]: added support for non-Warp 4 SYM files
    16841684 *@@changed V0.9.3 (2000-04-26) [umoeller]: this broke Warp 4 FP 13, fixed
     1685 *@@changed V1.0.12 (2017-01-15) [rwalsh]: improve handling for Warp 4.5 SYM files
    16851686 */
    16861687
     
    16901691                        ULONG ulOffset)
    16911692{
    1692     APIRET arc = 0;
    1693     // "Source file"... columns
    1694 
    1695     // first attempt to analyze the debug code
    1696     arc = dbgPrintDebugInfo(LogFile,
    1697                             pszModuleName,
    1698                             ulObject,
    1699                             ulOffset);
    1700     // if no debug code is available, analyze
    1701     // the SYM file instead
    1702     if (arc != NO_ERROR)
    1703     {
    1704         CHAR szSymName[CCHMAXPATH];
    1705         strcpy(szSymName, pszModuleName);
    1706         strcpy(szSymName + strlen(szSymName) - 3, "SYM");
    1707         arc = dbgPrintSYMInfo(LogFile,
    1708                               szSymName,
    1709                               ulObject,
    1710                               ulOffset);
    1711         if (arc != 0)
    1712         {
    1713             // SYM file not found in current directory:
    1714             // check the SYM files in the \OS2 directory,
    1715             // depending on the OS/2 version level:
    1716             CHAR szSymFile2[CCHMAXPATH];
    1717             PSZ  pszFilename = strrchr(szSymName, '\\');
    1718             if (pszFilename)
    1719             {
    1720                 PSZ         pszVersionDir = "WARP4";
    1721                 ULONG       aulBuf[3];
    1722 
    1723                 DosQuerySysInfo(QSV_VERSION_MAJOR,      // 11
    1724                                 QSV_VERSION_MINOR,      // 12
    1725                                 &aulBuf, sizeof(aulBuf));
    1726                 // Warp 3 is reported as 20.30
    1727                 // Warp 4 is reported as 20.40
    1728                 // Aurora is reported as 20.45
    1729 
    1730                 if (aulBuf[0] == 20)
    1731                 {
    1732                     if (aulBuf[1] == 30)
    1733                         // Warp 3:
    1734                         pszVersionDir = "WARP3";
    1735                     else if (aulBuf[1] >= 40)
    1736                         // Warp 4 or higher:
    1737                         // (NOTE: Warp 4 FP 13 now returns 45 also,
    1738                         // but the SYM files are still in the WARP4 directory...)
    1739                         // V0.9.3 (2000-04-26) [umoeller]
    1740                         pszVersionDir = "WARP4";
    1741                 }
    1742 
    1743                 pszFilename++;
    1744                 sprintf(szSymFile2,
    1745                         "%c:\\OS2\\PDPSI\\PMDF\\%s\\%s",
    1746                         doshQueryBootDrive(),
    1747                         pszVersionDir,
    1748                         pszFilename);
    1749                 arc = dbgPrintSYMInfo(LogFile,
    1750                                       szSymFile2,
    1751                                       ulObject,
    1752                                       ulOffset);
    1753 
    1754                 // V0.9.3 (2000-04-26) [umoeller]
    1755                 if (    (arc != 0)  // still not found
    1756                      && (aulBuf[1] == 45) // and running Aurora or Warp 4 FP13?
    1757                    )
    1758                 {
    1759                     // Warp Server for e-Business (aka Warp 4.5):
    1760                     // we use the SYM files for the UNI kernel,
    1761                     // I have found no way to find out whether
    1762                     // we're running on an SMP kernel
    1763                     sprintf(szSymFile2,
    1764                             "%c:\\OS2\\PDPSI\\PMDF\\%s\\%s",
    1765                             doshQueryBootDrive(),
    1766                             "WARP45_U",
    1767                             pszFilename);
    1768                     arc = dbgPrintSYMInfo(LogFile,
    1769                                           szSymFile2,
    1770                                           ulObject,
    1771                                           ulOffset);
    1772                 }
    1773             }
    1774         }
    1775 
    1776         if (arc == 2)       // file not found
    1777             fprintf(LogFile,
    1778                     "Cannot find symbol file %s\n",
    1779                     szSymName);
    1780         else if (arc != 0)
    1781             fprintf(LogFile,
    1782                     "Error %lu reading symbol file %s\n",
    1783                     arc,
    1784                     szSymName);
    1785     }
     1693    APIRET  arc = 0;
     1694    PSZ     pszFilename;
     1695    PSZ     pszVersionDir;
     1696    ULONG   aulBuf[3];
     1697    CHAR    szSymName[CCHMAXPATH];
     1698    CHAR    szSymPath[CCHMAXPATH];
     1699
     1700    // look for .sym in the module's directory
     1701    strcpy(szSymName, pszModuleName);
     1702    strcpy(szSymName + strlen(szSymName) - 3, "SYM");
     1703    if (!dbgPrintSYMInfo(LogFile, szSymName, ulObject, ulOffset))
     1704        return TRUE;
     1705
     1706    pszFilename = strrchr(szSymName, '\\');
     1707    if (!pszFilename)
     1708    {
     1709        fprintf(LogFile, "Cannot find symbol file for %s\n", pszModuleName);
     1710        return FALSE;
     1711    }
     1712    pszFilename++;
     1713
     1714    // check the SYM files in the \OS2 directory,
     1715    // depending on the OS/2 version level:
     1716    DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR,
     1717                    &aulBuf, sizeof(aulBuf));
     1718
     1719    // Warp 3 is reported as 20.30
     1720    // Warp 4 is reported as 20.40
     1721    // WSEB   is reported as 20.45
     1722    // (NOTE: Warp 4 FP 13 now returns 45 also,
     1723    // but the SYM files are still in the WARP4 directory)
     1724
     1725    // try the directories used by the "real" Warp 4.5 first
     1726    if (aulBuf[1] == 45)
     1727    {
     1728        sprintf(szSymPath, "%c:\\OS2\\PDPSI\\PMDF\\%s\\%s",
     1729                doshQueryBootDrive(), "WARP45", pszFilename);
     1730        if (!dbgPrintSYMInfo(LogFile, szSymPath, ulObject, ulOffset))
     1731            return TRUE;
     1732
     1733        // use the nbr of processors to decide which directory to search
     1734        if (DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS,
     1735                            &aulBuf[2], sizeof(aulBuf[2]))
     1736            || aulBuf[2] == 1)
     1737            pszVersionDir = "WARP45_U";
     1738        else
     1739            pszVersionDir = "WARP45_S";
     1740
     1741        sprintf(szSymPath, "%c:\\OS2\\PDPSI\\PMDF\\%s\\%s",
     1742                doshQueryBootDrive(), pszVersionDir, pszFilename);
     1743        if (!dbgPrintSYMInfo(LogFile, szSymPath, ulObject, ulOffset))
     1744            return TRUE;
     1745    }
     1746
     1747    // deal with Warp 3 and Warp4 pre- and post-FP13
     1748    if (aulBuf[1] == 30)
     1749        pszVersionDir = "WARP3";
     1750    else
     1751        pszVersionDir = "WARP4";
     1752
     1753    sprintf(szSymPath, "%c:\\OS2\\PDPSI\\PMDF\\%s\\%s",
     1754            doshQueryBootDrive(), pszVersionDir, pszFilename);
     1755    arc = dbgPrintSYMInfo(LogFile, szSymPath, ulObject, ulOffset);
     1756
     1757    if (arc == 2)
     1758        fprintf(LogFile, "Cannot find symbol file %s\n",
     1759                szSymName);
     1760    else if (arc != 0)
     1761        fprintf(LogFile, "Error %lu reading symbol file %s\n",
     1762                arc, szSymName);
    17861763
    17871764    return (arc == NO_ERROR);
     
    19941971                    if (strlen(Name) > 3)
    19951972                    {
    1996                         dbgPrintStackFrame(LogFile,
    1997                                            Name,
    1998                                            ObjNum,
    1999                                            Offset);
     1973                        // look for embedded debug info;
     1974                        // if that fails, look for a .sym file
     1975                        if (dbgPrintDebugInfo(LogFile,
     1976                                              Name,
     1977                                              ObjNum,
     1978                                              Offset))
     1979                            dbgPrintStackFrame(LogFile,
     1980                                               Name,
     1981                                               ObjNum,
     1982                                               Offset);
    20001983                    }
    20011984                }
Note: See TracChangeset for help on using the changeset viewer.