Changeset 20801 in vbox
- Timestamp:
- Jun 23, 2009 12:10:32 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/iprt/dbg.h (modified) (1 diff)
-
src/VBox/Runtime/common/dbg/dbgmod.cpp (modified) (6 diffs)
-
src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp (modified) (4 diffs)
-
src/VBox/Runtime/include/internal/dbgmod.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/dbg.h
r20800 r20801 755 755 RTDECL(RTUINTPTR) RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg); 756 756 757 RTDECL(int) RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off, RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal); 757 758 /** 759 * Adds a line number to the module. 760 * 761 * @returns IPRT status code. 762 * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding 763 * custom symbols. This is a common place occurance. 764 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 765 * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or 766 * short. 767 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 768 * it's not inside any of the segments defined by the module. 769 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 770 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 771 * end of the segment. 772 * @retval VERR_DBG_ADDRESS_WRAP if off+cb wraps around. 773 * @retval VERR_INVALID_PARAMETER if the symbol flags sets undefined bits. 774 * 775 * @param hDbgMod The module handle. 776 * @param pszSymbol The symbol name. 777 * @param iSeg The segment index. 778 * @param off The segment offset. 779 * @param cb The size of the symbol. Can be zero, although this 780 * may depend somewhat on the debug interpreter. 781 * @param fFlags Symbol flags. Reserved for the future, MBZ. 782 * @param piOrdinal Where to return the symbol ordinal on success. If 783 * the interpreter doesn't do ordinals, this will be set to 784 * UINT32_MAX. Optional. 785 */ 786 RTDECL(int) RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off, 787 RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal); 788 789 /** 790 * Gets the symbol count. 791 * 792 * This can be used together wtih RTDbgModSymbolByOrdinal or 793 * RTDbgModSymbolByOrdinalA to enumerate all the symbols. 794 * 795 * @returns The number of symbols in the module. 796 * UINT32_MAX is returned if the module handle is invalid or some other 797 * error occurs. 798 * 799 * @param hDbgMod The module handle. 800 */ 758 801 RTDECL(uint32_t) RTDbgModSymbolCount(RTDBGMOD hDbgMod); 802 803 /** 804 * Queries symbol information by ordinal number. 805 * 806 * @returns IPRT status code. 807 * @retval VERR_SYMBOL_NOT_FOUND if there is no symbol at the given number. 808 * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols. 809 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 810 * @retval VERR_NOT_SUPPORTED if lookup by ordinal is not supported. 811 * 812 * @param hDbgMod The module handle. 813 * @param iOrdinal The symbol ordinal number. 0-based. The highest 814 * number is RTDbgModSymbolCount() - 1. 815 * @param pSymInfo Where to store the symbol information. 816 */ 759 817 RTDECL(int) RTDbgModSymbolByOrdinal(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGSYMBOL pSymInfo); 818 819 /** 820 * Queries symbol information by ordinal number. 821 * 822 * @returns IPRT status code. 823 * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols. 824 * @retval VERR_NOT_SUPPORTED if lookup by ordinal is not supported. 825 * @retval VERR_SYMBOL_NOT_FOUND if there is no symbol at the given number. 826 * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails. 827 * 828 * @param hDbgMod The module handle. 829 * @param iOrdinal The symbol ordinal number. 0-based. The highest 830 * number is RTDbgModSymbolCount() - 1. 831 * @param ppSymInfo Where to store the pointer to the returned 832 * symbol information. Always set. Free with 833 * RTDbgSymbolFree. 834 */ 760 835 RTDECL(int) RTDbgModSymbolByOrdinalA(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGSYMBOL *ppSymInfo); 836 837 /** 838 * Queries symbol information by address. 839 * 840 * The returned symbol is what the debug info interpreter consideres the symbol 841 * most applicable to the specified address. This usually means a symbol with an 842 * address equal or lower than the requested. 843 * 844 * @returns IPRT status code. 845 * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found. 846 * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols. 847 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 848 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 849 * it's not inside any of the segments defined by the module. 850 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 851 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 852 * end of the segment. 853 * 854 * @param hDbgMod The module handle. 855 * @param iSeg The segment number. 856 * @param off The offset into the segment. 857 * @param poffDisp Where to store the distance between the 858 * specified address and the returned symbol. 859 * Optional. 860 * @param pSymInfo Where to store the symbol information. 861 */ 761 862 RTDECL(int) RTDbgModSymbolByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymInfo); 863 864 /** 865 * Queries symbol information by address. 866 * 867 * The returned symbol is what the debug info interpreter consideres the symbol 868 * most applicable to the specified address. This usually means a symbol with an 869 * address equal or lower than the requested. 870 * 871 * @returns IPRT status code. 872 * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found. 873 * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols. 874 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 875 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 876 * it's not inside any of the segments defined by the module. 877 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 878 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 879 * end of the segment. 880 * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails. 881 * 882 * @param hDbgMod The module handle. 883 * @param iSeg The segment index. 884 * @param off The offset into the segment. 885 * @param poffDisp Where to store the distance between the 886 * specified address and the returned symbol. Optional. 887 * @param ppSymInfo Where to store the pointer to the returned 888 * symbol information. Always set. Free with 889 * RTDbgSymbolFree. 890 */ 762 891 RTDECL(int) RTDbgModSymbolByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymInfo); 892 893 /** 894 * Queries symbol information by symbol name. 895 * 896 * @returns IPRT status code. 897 * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols. 898 * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found. 899 * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or 900 * short. 901 * 902 * @param hDbgMod The module handle. 903 * @param pszSymbol The symbol name. 904 * @param pSymInfo Where to store the symbol information. 905 */ 763 906 RTDECL(int) RTDbgModSymbolByName(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL pSymInfo); 907 908 /** 909 * Queries symbol information by symbol name. 910 * 911 * @returns IPRT status code. 912 * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols. 913 * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found. 914 * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or 915 * short. 916 * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails. 917 * 918 * @param hDbgMod The module handle. 919 * @param pszSymbol The symbol name. 920 * @param ppSymInfo Where to store the pointer to the returned 921 * symbol information. Always set. Free with 922 * RTDbgSymbolFree. 923 */ 764 924 RTDECL(int) RTDbgModSymbolByNameA(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL *ppSymInfo); 765 925 766 RTDECL(int) RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t *piOrdinal); 926 /** 927 * Adds a line number to the module. 928 * 929 * @returns IPRT status code. 930 * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding 931 * custom symbols. This should be consider a normal response. 932 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 933 * @retval VERR_DBG_FILE_NAME_OUT_OF_RANGE if the file name is too longer or 934 * empty. 935 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 936 * it's not inside any of the segments defined by the module. 937 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 938 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 939 * end of the segment. 940 * @retval VERR_INVALID_PARAMETER if the line number flags sets undefined bits. 941 * 942 * @param hDbgMod The module handle. 943 * @param pszFile The file name. 944 * @param uLineNo The line number. 945 * @param iSeg The segment index. 946 * @param off The segment offset. 947 * @param piOrdinal Where to return the line number ordinal on 948 * success. If the interpreter doesn't do ordinals, 949 * this will be set to UINT32_MAX. Optional. 950 */ 951 RTDECL(int) RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo, 952 RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t *piOrdinal); 953 954 /** 955 * Gets the line number count. 956 * 957 * This can be used together wtih RTDbgModLineByOrdinal or RTDbgModSymbolByLineA 958 * to enumerate all the line number information. 959 * 960 * @returns The number of line numbers in the module. 961 * UINT32_MAX is returned if the module handle is invalid or some other 962 * error occurs. 963 * 964 * @param hDbgMod The module handle. 965 */ 767 966 RTDECL(uint32_t) RTDbgModLineCount(RTDBGMOD hDbgMod); 768 RTDECL(int) RTDbgModLineByOrdinal(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE pLine); 769 RTDECL(int) RTDbgModLineByOrdinalA(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE *ppLine); 770 RTDECL(int) RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLine); 771 RTDECL(int) RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLine); 967 968 /** 969 * Queries line number information by ordinal number. 970 * 971 * This can be used to enumerate the line numbers for the module. Use 972 * RTDbgModLineCount() to figure the end of the ordinals. 973 * 974 * @returns IPRT status code. 975 * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers. 976 * @retval VERR_DBG_LINE_NOT_FOUND if there is no line number with that 977 * ordinal. 978 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 979 980 * @param hDbgMod The module handle. 981 * @param iOrdinal The line number ordinal number. 982 * @param pLineInfo Where to store the information about the line 983 * number. 984 */ 985 RTDECL(int) RTDbgModLineByOrdinal(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo); 986 987 /** 988 * Queries line number information by ordinal number. 989 * 990 * This can be used to enumerate the line numbers for the module. Use 991 * RTDbgModLineCount() to figure the end of the ordinals. 992 * 993 * @returns IPRT status code. 994 * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers. 995 * @retval VERR_DBG_LINE_NOT_FOUND if there is no line number with that 996 * ordinal. 997 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 998 * @retval VERR_NO_MEMORY if RTDbgLineAlloc fails. 999 * 1000 * @param hDbgMod The module handle. 1001 * @param iOrdinal The line number ordinal number. 1002 * @param ppLineInfo Where to store the pointer to the returned line 1003 * number information. Always set. Free with 1004 * RTDbgLineFree. 1005 */ 1006 RTDECL(int) RTDbgModLineByOrdinalA(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE *ppLineInfo); 1007 1008 /** 1009 * Queries line number information by address. 1010 * 1011 * The returned line number is what the debug info interpreter consideres the 1012 * one most applicable to the specified address. This usually means a line 1013 * number with an address equal or lower than the requested. 1014 * 1015 * @returns IPRT status code. 1016 * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers. 1017 * @retval VERR_DBG_LINE_NOT_FOUND if no suitable line number was found. 1018 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 1019 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 1020 * it's not inside any of the segments defined by the module. 1021 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 1022 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 1023 * end of the segment. 1024 * 1025 * @param hDbgMod The module handle. 1026 * @param iSeg The segment number. 1027 * @param off The offset into the segment. 1028 * @param poffDisp Where to store the distance between the 1029 * specified address and the returned symbol. 1030 * Optional. 1031 * @param pSymInfo Where to store the symbol information. 1032 */ 1033 RTDECL(int) RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLineInfo); 1034 1035 /** 1036 * Queries line number information by address. 1037 * 1038 * The returned line number is what the debug info interpreter consideres the 1039 * one most applicable to the specified address. This usually means a line 1040 * number with an address equal or lower than the requested. 1041 * 1042 * @returns IPRT status code. 1043 * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers. 1044 * @retval VERR_DBG_LINE_NOT_FOUND if no suitable line number was found. 1045 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 1046 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 1047 * it's not inside any of the segments defined by the module. 1048 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 1049 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 1050 * end of the segment. 1051 * @retval VERR_NO_MEMORY if RTDbgLineAlloc fails. 1052 * 1053 * @param hDbgMod The module handle. 1054 * @param iSeg The segment number. 1055 * @param off The offset into the segment. 1056 * @param poffDisp Where to store the distance between the 1057 * specified address and the returned symbol. 1058 * Optional. 1059 * @param ppLineInfo Where to store the pointer to the returned line 1060 * number information. Always set. Free with 1061 * RTDbgLineFree. 1062 */ 1063 RTDECL(int) RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLineInfo); 772 1064 /** @} */ 773 1065 -
trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp
r20800 r20801 751 751 * end of the segment. 752 752 * 753 * @param pMod Pointer to the module structure. 754 * @param iSeg The segment number (0-based) or RTDBGSEGIDX_ABS. 755 * @param off The offset into the segment. 756 * @param poffDisp Where to store the distance between the specified address 757 * and the returned symbol. Optional. 758 * @param pSymInfo Where to store the symbol information. 753 * @param hDbgMod The module handle. 754 * @param iSeg The segment number. 755 * @param off The offset into the segment. 756 * @param poffDisp Where to store the distance between the 757 * specified address and the returned symbol. 758 * Optional. 759 * @param pSymInfo Where to store the symbol information. 759 760 */ 760 761 RTDECL(int) RTDbgModSymbolByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymInfo) … … 764 765 */ 765 766 PRTDBGMODINT pDbgMod = hDbgMod; 766 RTDBGMOD_VALID_RETURN_RC(pDbgMod, UINT32_MAX);767 RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE); 767 768 AssertPtrNull(poffDisp); 768 769 AssertPtr(pSymInfo); … … 858 859 */ 859 860 PRTDBGMODINT pDbgMod = hDbgMod; 860 RTDBGMOD_VALID_RETURN_RC(pDbgMod, UINT32_MAX);861 RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE); 861 862 AssertPtr(pszSymbol); 862 863 size_t cchSymbol = strlen(pszSymbol); … … 884 885 * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or 885 886 * short. 886 *887 887 * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails. 888 * 888 889 * @param hDbgMod The module handle. 889 890 * @param pszSymbol The symbol name. … … 915 916 * 916 917 * @returns IPRT status code. 918 * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding 919 * custom symbols. This should be consider a normal response. 917 920 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 918 * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding 919 * custom symbols. 920 * @retval VERR_DBG_FILE_NAME_OUT_OF_RANGE 921 * @retval VERR_DBG_INVALID_RVA 922 * @retval VERR_DBG_INVALID_SEGMENT_INDEX 923 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET 924 * @retval VERR_INVALID_PARAMETER 925 * 926 * @param hDbgMod The module handle. 927 * @param pszFile The file name. 928 * @param uLineNo The line number. 929 * @param iSeg The segment index. 930 * @param off The segment offset. 931 * @param piOrdinal Where to return the line number ordinal on success. 932 * If the interpreter doesn't do ordinals, this will be 933 * set to UINT32_MAX. Optional. 934 */ 935 RTDECL(int) RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t *piOrdinal) 921 * @retval VERR_DBG_FILE_NAME_OUT_OF_RANGE if the file name is too longer or 922 * empty. 923 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 924 * it's not inside any of the segments defined by the module. 925 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 926 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 927 * end of the segment. 928 * @retval VERR_INVALID_PARAMETER if the line number flags sets undefined bits. 929 * 930 * @param hDbgMod The module handle. 931 * @param pszFile The file name. 932 * @param uLineNo The line number. 933 * @param iSeg The segment index. 934 * @param off The segment offset. 935 * @param piOrdinal Where to return the line number ordinal on 936 * success. If the interpreter doesn't do ordinals, 937 * this will be set to UINT32_MAX. Optional. 938 */ 939 RTDECL(int) RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo, 940 RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t *piOrdinal) 936 941 { 937 942 /* … … 975 980 976 981 977 RTDECL(int) RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLine) 978 { 979 return VERR_NOT_IMPLEMENTED; 980 } 981 982 RTDECL(int) RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLine) 983 { 984 return VERR_NOT_IMPLEMENTED; 985 } 986 982 /** 983 * Gets the line number count. 984 * 985 * This can be used together wtih RTDbgModLineByOrdinal or RTDbgModSymbolByLineA 986 * to enumerate all the line number information. 987 * 988 * @returns The number of line numbers in the module. 989 * UINT32_MAX is returned if the module handle is invalid or some other 990 * error occurs. 991 * 992 * @param hDbgMod The module handle. 993 */ 994 RTDECL(uint32_t) RTDbgModLineCount(RTDBGMOD hDbgMod) 995 { 996 PRTDBGMODINT pDbgMod = hDbgMod; 997 RTDBGMOD_VALID_RETURN_RC(pDbgMod, UINT32_MAX); 998 RTDBGMOD_LOCK(pDbgMod); 999 1000 uint32_t cLineNumbers = pDbgMod->pDbgVt->pfnLineCount(pDbgMod); 1001 1002 RTDBGMOD_UNLOCK(pDbgMod); 1003 return cLineNumbers; 1004 } 1005 1006 1007 /** 1008 * Queries line number information by ordinal number. 1009 * 1010 * This can be used to enumerate the line numbers for the module. Use 1011 * RTDbgModLineCount() to figure the end of the ordinals. 1012 * 1013 * @returns IPRT status code. 1014 * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers. 1015 * @retval VERR_DBG_LINE_NOT_FOUND if there is no line number with that 1016 * ordinal. 1017 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 1018 1019 * @param hDbgMod The module handle. 1020 * @param iOrdinal The line number ordinal number. 1021 * @param pLineInfo Where to store the information about the line 1022 * number. 1023 */ 1024 RTDECL(int) RTDbgModLineByOrdinal(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo) 1025 { 1026 PRTDBGMODINT pDbgMod = hDbgMod; 1027 RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE); 1028 RTDBGMOD_LOCK(pDbgMod); 1029 1030 int rc = pDbgMod->pDbgVt->pfnLineByOrdinal(pDbgMod, iOrdinal, pLineInfo); 1031 1032 RTDBGMOD_UNLOCK(pDbgMod); 1033 return rc; 1034 } 1035 1036 1037 /** 1038 * Queries line number information by ordinal number. 1039 * 1040 * This can be used to enumerate the line numbers for the module. Use 1041 * RTDbgModLineCount() to figure the end of the ordinals. 1042 * 1043 * @returns IPRT status code. 1044 * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers. 1045 * @retval VERR_DBG_LINE_NOT_FOUND if there is no line number with that 1046 * ordinal. 1047 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 1048 * @retval VERR_NO_MEMORY if RTDbgLineAlloc fails. 1049 * 1050 * @param hDbgMod The module handle. 1051 * @param iOrdinal The line number ordinal number. 1052 * @param ppLineInfo Where to store the pointer to the returned line 1053 * number information. Always set. Free with 1054 * RTDbgLineFree. 1055 */ 1056 RTDECL(int) RTDbgModLineByOrdinalA(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE *ppLineInfo) 1057 { 1058 AssertPtr(ppLineInfo); 1059 *ppLineInfo = NULL; 1060 1061 PRTDBGLINE pLineInfo = RTDbgLineAlloc(); 1062 if (!pLineInfo) 1063 return VERR_NO_MEMORY; 1064 1065 int rc = RTDbgModLineByOrdinal(hDbgMod, iOrdinal, pLineInfo); 1066 1067 if (RT_SUCCESS(rc)) 1068 *ppLineInfo = pLineInfo; 1069 else 1070 RTDbgLineFree(pLineInfo); 1071 return rc; 1072 } 1073 1074 1075 /** 1076 * Queries line number information by address. 1077 * 1078 * The returned line number is what the debug info interpreter consideres the 1079 * one most applicable to the specified address. This usually means a line 1080 * number with an address equal or lower than the requested. 1081 * 1082 * @returns IPRT status code. 1083 * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers. 1084 * @retval VERR_DBG_LINE_NOT_FOUND if no suitable line number was found. 1085 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 1086 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 1087 * it's not inside any of the segments defined by the module. 1088 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 1089 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 1090 * end of the segment. 1091 * 1092 * @param hDbgMod The module handle. 1093 * @param iSeg The segment number. 1094 * @param off The offset into the segment. 1095 * @param poffDisp Where to store the distance between the 1096 * specified address and the returned symbol. 1097 * Optional. 1098 * @param pSymInfo Where to store the symbol information. 1099 */ 1100 RTDECL(int) RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLineInfo) 1101 { 1102 /* 1103 * Validate input. 1104 */ 1105 PRTDBGMODINT pDbgMod = hDbgMod; 1106 RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE); 1107 RTDBGMOD_LOCK(pDbgMod); 1108 AssertPtrNull(poffDisp); 1109 AssertPtr(pLineInfo); 1110 1111 RTDBGMOD_LOCK(pDbgMod); 1112 1113 /* 1114 * Convert RVAs. 1115 */ 1116 if (iSeg == RTDBGSEGIDX_RVA) 1117 { 1118 iSeg = pDbgMod->pDbgVt->pfnRvaToSegOff(pDbgMod, off, &off); 1119 if (iSeg == NIL_RTDBGSEGIDX) 1120 { 1121 RTDBGMOD_UNLOCK(pDbgMod); 1122 return VERR_DBG_INVALID_RVA; 1123 } 1124 } 1125 1126 int rc = pDbgMod->pDbgVt->pfnLineByAddr(pDbgMod, iSeg, off, poffDisp, pLineInfo); 1127 1128 RTDBGMOD_UNLOCK(pDbgMod); 1129 return rc; 1130 } 1131 1132 1133 /** 1134 * Queries line number information by address. 1135 * 1136 * The returned line number is what the debug info interpreter consideres the 1137 * one most applicable to the specified address. This usually means a line 1138 * number with an address equal or lower than the requested. 1139 * 1140 * @returns IPRT status code. 1141 * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers. 1142 * @retval VERR_DBG_LINE_NOT_FOUND if no suitable line number was found. 1143 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 1144 * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and 1145 * it's not inside any of the segments defined by the module. 1146 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid. 1147 * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the 1148 * end of the segment. 1149 * @retval VERR_NO_MEMORY if RTDbgLineAlloc fails. 1150 * 1151 * @param hDbgMod The module handle. 1152 * @param iSeg The segment number. 1153 * @param off The offset into the segment. 1154 * @param poffDisp Where to store the distance between the 1155 * specified address and the returned symbol. 1156 * Optional. 1157 * @param ppLineInfo Where to store the pointer to the returned line 1158 * number information. Always set. Free with 1159 * RTDbgLineFree. 1160 */ 1161 RTDECL(int) RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLineInfo) 1162 { 1163 AssertPtr(ppLineInfo); 1164 *ppLineInfo = NULL; 1165 1166 PRTDBGLINE pLineInfo = RTDbgLineAlloc(); 1167 if (!pLineInfo) 1168 return VERR_NO_MEMORY; 1169 1170 int rc = RTDbgModLineByAddr(hDbgMod, iSeg, off, poffDisp, pLineInfo); 1171 1172 if (RT_SUCCESS(rc)) 1173 *ppLineInfo = pLineInfo; 1174 else 1175 RTDbgLineFree(pLineInfo); 1176 return rc; 1177 } 1178 -
trunk/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
r20800 r20801 137 137 /** @copydoc RTDBGMODVTDBG::pfnLineByAddr */ 138 138 static DECLCALLBACK(int) rtDbgModContainer_LineByAddr(PRTDBGMODINT pMod, RTDBGSEGIDX iSeg, RTUINTPTR off, 139 PRTINTPTR poffDisp, PRTDBGLINE pLine )139 PRTINTPTR poffDisp, PRTDBGLINE pLineInfo) 140 140 { 141 141 PRTDBGMODCTN pThis = (PRTDBGMODCTN)pMod->pvDbgPriv; … … 160 160 : VERR_DBG_NO_LINE_NUMBERS; 161 161 PCRTDBGMODCTNLINE pMyLine = RT_FROM_MEMBER(pAvlCore, RTDBGMODCTNLINE const, AddrCore); 162 pLine ->Address = pMyLine->AddrCore.Key;163 pLine ->offSeg = pMyLine->AddrCore.Key;164 pLine ->iSeg = iSeg;165 pLine ->uLineNo = pMyLine->uLineNo;166 pLine ->iOrdinal = pMyLine->OrdinalCore.Key;167 strcpy(pLine ->szFilename, pMyLine->pszFile);162 pLineInfo->Address = pMyLine->AddrCore.Key; 163 pLineInfo->offSeg = pMyLine->AddrCore.Key; 164 pLineInfo->iSeg = iSeg; 165 pLineInfo->uLineNo = pMyLine->uLineNo; 166 pLineInfo->iOrdinal = pMyLine->OrdinalCore.Key; 167 strcpy(pLineInfo->szFilename, pMyLine->pszFile); 168 168 if (poffDisp) 169 169 *poffDisp = off - pMyLine->AddrCore.Key; … … 173 173 174 174 /** @copydoc RTDBGMODVTDBG::pfnLineByOrdinal */ 175 static DECLCALLBACK(int) rtDbgModContainer_LineByOrdinal(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGLINE pLine )175 static DECLCALLBACK(int) rtDbgModContainer_LineByOrdinal(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo) 176 176 { 177 177 PRTDBGMODCTN pThis = (PRTDBGMODCTN)pMod->pvDbgPriv; … … 187 187 AssertReturn(pAvlCore, VERR_DBG_LINE_NOT_FOUND); 188 188 PCRTDBGMODCTNLINE pMyLine = RT_FROM_MEMBER(pAvlCore, RTDBGMODCTNLINE const, OrdinalCore); 189 pLine ->Address = pMyLine->AddrCore.Key;190 pLine ->offSeg = pMyLine->AddrCore.Key;191 pLine ->iSeg = pMyLine->iSeg;192 pLine ->uLineNo = pMyLine->uLineNo;193 pLine ->iOrdinal = pMyLine->OrdinalCore.Key;194 strcpy(pLine ->szFilename, pMyLine->pszFile);189 pLineInfo->Address = pMyLine->AddrCore.Key; 190 pLineInfo->offSeg = pMyLine->AddrCore.Key; 191 pLineInfo->iSeg = pMyLine->iSeg; 192 pLineInfo->uLineNo = pMyLine->uLineNo; 193 pLineInfo->iOrdinal = pMyLine->OrdinalCore.Key; 194 strcpy(pLineInfo->szFilename, pMyLine->pszFile); 195 195 return VINF_SUCCESS; 196 196 } -
trunk/src/VBox/Runtime/include/internal/dbgmod.h
r20800 r20801 335 335 * @param pMod Pointer to the module structure. 336 336 * @param iOrdinal The line number ordinal number. 337 * @param pLine Where to store the information about the line number.338 */ 339 DECLCALLBACKMEMBER(int, pfnLineByOrdinal)(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGLINE pLine );337 * @param pLineInfo Where to store the information about the line number. 338 */ 339 DECLCALLBACKMEMBER(int, pfnLineByOrdinal)(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo); 340 340 341 341 /** … … 352 352 * @param poffDisp Where to store the distance between the specified address 353 353 * and the returned line number. Optional. 354 * @param pLine Where to store the information about the closest line number. 355 */ 356 DECLCALLBACKMEMBER(int, pfnLineByAddr)(PRTDBGMODINT pMod, uint32_t iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLine); 354 * @param pLineInfo Where to store the information about the closest line 355 * number. 356 */ 357 DECLCALLBACKMEMBER(int, pfnLineByAddr)(PRTDBGMODINT pMod, uint32_t iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLineInfo); 357 358 358 359
Note:
See TracChangeset
for help on using the changeset viewer.

