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