Lines Matching defs:pDbgc

251  * @param   pDbgc           Pointer to the debugger instance.
264 static void tstTryExV(PDBGC pDbgc, const char *pszCmds, int rcCmd, bool fNoExecute, const char *pszExpected,
275 pDbgc->rcCmd = VERR_INTERNAL_ERROR;
276 dbgcProcessInput(pDbgc, fNoExecute);
279 if (pDbgc->rcCmd != rcCmd)
280 RTTestFailed(g_hTest, "rcCmd=%Rrc expected =%Rrc\n", pDbgc->rcCmd, rcCmd);
288 PCDBGCVAR paArgs = pDbgc->aArgs;
336 * @param pDbgc Pointer to the debugger instance.
349 static void tstTryEx(PDBGC pDbgc, const char *pszCmds, int rcCmd, bool fNoExecute, const char *pszExpected, int32_t cArgs, ...)
353 tstTryExV(pDbgc, pszCmds, rcCmd, fNoExecute, pszExpected, cArgs, va);
361 * @param pDbgc Pointer to the debugger instance.
365 static void tstTry(PDBGC pDbgc, const char *pszCmds, int rcCmd)
367 return tstTryEx(pDbgc, pszCmds, rcCmd, true /*fNoExecute*/, NULL, -1);
374 * @param pDbgc Pointer to the debugger instance.
381 static void tstTryExec(PDBGC pDbgc, const char *pszCmds, int rcCmd, const char *pszExpected)
383 return tstTryEx(pDbgc, pszCmds, rcCmd, false /*fNoExecute*/, pszExpected, -1);
391 * @param pDbgc Pointer to the debugger instance.
395 static void tstNumOp(PDBGC pDbgc, const char *pszExpr, uint64_t u64Expect)
404 return tstTryEx(pDbgc, szCmd, VINF_SUCCESS, false /*fNoExecute*/, szExpected, -1);
417 static void testCodeView_ba(PDBGC pDbgc)
420 tstTry(pDbgc, "ba x 1 0f000:0000\n", VINF_SUCCESS);
421 tstTry(pDbgc, "ba x 1 0f000:0000 0\n", VINF_SUCCESS);
422 tstTry(pDbgc, "ba x 1 0f000:0000 0 ~0\n", VINF_SUCCESS);
423 tstTry(pDbgc, "ba x 1 0f000:0000 0 ~0 \"command\"\n", VINF_SUCCESS);
424 tstTry(pDbgc, "ba x 1 0f000:0000 0 ~0 \"command\" too_many\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
425 tstTry(pDbgc, "ba x 1\n", VERR_DBGC_PARSE_TOO_FEW_ARGUMENTS);
427 tstTryEx(pDbgc, "ba x 1 0f000:1234 5 1000 \"command\"\n", VINF_SUCCESS,
436 tstTryEx(pDbgc, "ba x 1 %0f000:1234 5 1000 \"command\"\n", VINF_SUCCESS,
445 tstTry(pDbgc, "ba x 1 bad:bad 5 1000 \"command\"\n", VINF_SUCCESS);
446 tstTry(pDbgc, "ba x 1 %bad:bad 5 1000 \"command\"\n", VERR_DBGC_PARSE_CONVERSION_FAILED);
448 tstTryEx(pDbgc, "ba f 1 0f000:1234 5 1000 \"command\"\n", VINF_SUCCESS,
457 tstTry(pDbgc, "ba x 1 0f000:1234 qnx 1000 \"command\"\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
458 tstTry(pDbgc, "ba x 1 0f000:1234 5 qnx \"command\"\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
459 tstTry(pDbgc, "ba x qnx 0f000:1234 5 1000 \"command\"\n", VERR_DBGC_PARSE_INVALID_NUMBER);
460 tstTry(pDbgc, "ba x 1 qnx 5 1000 \"command\"\n", VERR_DBGC_PARSE_INVALID_NUMBER);
464 static void testCodeView_bc(PDBGC pDbgc)
470 static void testCodeView_bd(PDBGC pDbgc)
476 static void testCodeView_be(PDBGC pDbgc)
482 static void testCodeView_bl(PDBGC pDbgc)
488 static void testCodeView_bp(PDBGC pDbgc)
494 static void testCodeView_br(PDBGC pDbgc)
500 static void testCodeView_d(PDBGC pDbgc)
506 static void testCodeView_da(PDBGC pDbgc)
512 static void testCodeView_db(PDBGC pDbgc)
518 static void testCodeView_dd(PDBGC pDbgc)
524 static void testCodeView_dg(PDBGC pDbgc)
530 static void testCodeView_dga(PDBGC pDbgc)
536 static void testCodeView_di(PDBGC pDbgc)
542 static void testCodeView_dia(PDBGC pDbgc)
548 static void testCodeView_dl(PDBGC pDbgc)
554 static void testCodeView_dla(PDBGC pDbgc)
560 static void testCodeView_dpd(PDBGC pDbgc)
566 static void testCodeView_dpda(PDBGC pDbgc)
572 static void testCodeView_dpdb(PDBGC pDbgc)
578 static void testCodeView_dpdg(PDBGC pDbgc)
584 static void testCodeView_dpdh(PDBGC pDbgc)
590 static void testCodeView_dph(PDBGC pDbgc)
596 static void testCodeView_dphg(PDBGC pDbgc)
602 static void testCodeView_dphh(PDBGC pDbgc)
608 static void testCodeView_dq(PDBGC pDbgc)
614 static void testCodeView_dt(PDBGC pDbgc)
620 static void testCodeView_dt16(PDBGC pDbgc)
626 static void testCodeView_dt32(PDBGC pDbgc)
632 static void testCodeView_dt64(PDBGC pDbgc)
638 static void testCodeView_dw(PDBGC pDbgc)
644 static void testCodeView_eb(PDBGC pDbgc)
650 static void testCodeView_ew(PDBGC pDbgc)
656 static void testCodeView_ed(PDBGC pDbgc)
662 static void testCodeView_eq(PDBGC pDbgc)
668 static void testCodeView_g(PDBGC pDbgc)
674 static void testCodeView_k(PDBGC pDbgc)
680 static void testCodeView_kg(PDBGC pDbgc)
686 static void testCodeView_kh(PDBGC pDbgc)
692 static void testCodeView_lm(PDBGC pDbgc)
698 static void testCodeView_lmo(PDBGC pDbgc)
704 static void testCodeView_ln(PDBGC pDbgc)
710 static void testCodeView_ls(PDBGC pDbgc)
716 static void testCodeView_m(PDBGC pDbgc)
722 static void testCodeView_r(PDBGC pDbgc)
728 static void testCodeView_rg(PDBGC pDbgc)
734 static void testCodeView_rg32(PDBGC pDbgc)
740 static void testCodeView_rg64(PDBGC pDbgc)
746 static void testCodeView_rh(PDBGC pDbgc)
752 static void testCodeView_rt(PDBGC pDbgc)
758 static void testCodeView_s(PDBGC pDbgc)
764 static void testCodeView_sa(PDBGC pDbgc)
770 static void testCodeView_sb(PDBGC pDbgc)
776 static void testCodeView_sd(PDBGC pDbgc)
782 static void testCodeView_sq(PDBGC pDbgc)
788 static void testCodeView_su(PDBGC pDbgc)
794 static void testCodeView_sw(PDBGC pDbgc)
800 static void testCodeView_t(PDBGC pDbgc)
806 static void testCodeView_y(PDBGC pDbgc)
812 static void testCodeView_u64(PDBGC pDbgc)
818 static void testCodeView_u32(PDBGC pDbgc)
824 static void testCodeView_u16(PDBGC pDbgc)
830 static void testCodeView_uv86(PDBGC pDbgc)
840 static void testCommon_bye_exit_quit(PDBGC pDbgc)
845 tstTry(pDbgc, "bye\n", VINF_SUCCESS);
846 tstTry(pDbgc, "bye x\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
847 tstTry(pDbgc, "bye 1\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
848 tstTry(pDbgc, "bye %bad:bad\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
849 tstTry(pDbgc, "exit\n", VINF_SUCCESS);
850 tstTry(pDbgc, "quit\n", VINF_SUCCESS);
854 static void testCommon_cpu(PDBGC pDbgc)
857 tstTry(pDbgc, "cpu\n", VINF_SUCCESS);
858 tstTry(pDbgc, "cpu 1\n", VINF_SUCCESS);
859 tstTry(pDbgc, "cpu 1 1\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
860 tstTry(pDbgc, "cpu emt\n", VERR_DBGC_PARSE_INVALID_NUMBER);
861 tstTry(pDbgc, "cpu @eax\n", VINF_SUCCESS);
862 tstTry(pDbgc, "cpu %bad:bad\n", VERR_DBGC_PARSE_CONVERSION_FAILED);
863 tstTry(pDbgc, "cpu '1'\n", VERR_DBGC_PARSE_INVALID_NUMBER);
867 static void testCommon_echo(PDBGC pDbgc)
870 tstTry(pDbgc, "echo\n", VERR_DBGC_PARSE_TOO_FEW_ARGUMENTS);
871 tstTry(pDbgc, "echo 1\n", VINF_SUCCESS);
872 tstTryEx(pDbgc, "echo 1 2 3 4 5 6\n", VINF_SUCCESS, false, "1 2 3 4 5 6", -1);
876 tstTryEx(pDbgc, "echo 1234567890abcdefghijklmn\n", VINF_SUCCESS, false, "1234567890abcdefghijklmn", -1);
880 tstTryEx(pDbgc, "echo 1 + 1\n", VINF_SUCCESS, false, "2", -1);
881 tstTryEx(pDbgc, "echo \"1 + 1\"\n", VINF_SUCCESS, false, "1 + 1", -1);
883 tstTryEx(pDbgc, "echo 0i10 + 6\n", VINF_SUCCESS, false, "10", -1);
884 tstTryEx(pDbgc, "echo \"0i10 + 6\"\n", VINF_SUCCESS, false, "0i10 + 6", -1);
886 tstTryEx(pDbgc, "echo %f000:0010\n", VINF_SUCCESS, false, "%00000000000f0010", -1);
887 tstTryEx(pDbgc, "echo \"%f000:0010\"\n", VINF_SUCCESS, false, "%f000:0010", -1);
889 tstTry(pDbgc, "echo %bad:bad\n", VERR_DBGC_PARSE_CONVERSION_FAILED);
893 static void testCommon_format(PDBGC pDbgc)
899 static void testCommon_detect(PDBGC pDbgc)
905 static void testCommon_harakiri(PDBGC pDbgc)
911 static void testCommon_help(PDBGC pDbgc)
917 static void testCommon_info(PDBGC pDbgc)
920 tstTry(pDbgc, "info 12fg\n", VINF_SUCCESS);
921 tstTry(pDbgc, "info fflags argument\n", VINF_SUCCESS);
925 static void testCommon_loadimage(PDBGC pDbgc)
931 static void testCommon_loadmap(PDBGC pDbgc)
937 static void testCommon_loadplugin(PDBGC pDbgc)
943 static void testCommon_loadseg(PDBGC pDbgc)
949 static void testCommon_loadsyms(PDBGC pDbgc)
955 static void testCommon_loadvars(PDBGC pDbgc)
961 static void testCommon_log(PDBGC pDbgc)
967 static void testCommon_logdest(PDBGC pDbgc)
973 static void testCommon_logflags(PDBGC pDbgc)
979 static void testCommon_runscript(PDBGC pDbgc)
985 static void testCommon_set(PDBGC pDbgc)
991 static void testCommon_showplugins(PDBGC pDbgc)
997 static void testCommon_showvars(PDBGC pDbgc)
1003 static void testCommon_stop(PDBGC pDbgc)
1009 static void testCommon_unloadplugin(PDBGC pDbgc)
1015 static void testCommon_unset(PDBGC pDbgc)
1021 static void testCommon_writecore(PDBGC pDbgc)
1032 static void testBasicsOddCases(PDBGC pDbgc)
1035 tstTry(pDbgc, "r @rax\n", VINF_SUCCESS);
1036 tstTry(pDbgc, "r @eax\n", VINF_SUCCESS);
1037 tstTry(pDbgc, "r @ah\n", VINF_SUCCESS);
1038 tstTry(pDbgc, "r @notavalidregister\n", VERR_DBGF_REGISTER_NOT_FOUND);
1042 static void testBasicsOperators(PDBGC pDbgc)
1045 tstNumOp(pDbgc, "1", 1);
1046 tstNumOp(pDbgc, "1", 1);
1047 tstNumOp(pDbgc, "1", 1);
1049 tstNumOp(pDbgc, "+1", 1);
1050 tstNumOp(pDbgc, "++++++1", 1);
1052 tstNumOp(pDbgc, "-1", UINT64_MAX);
1053 tstNumOp(pDbgc, "--1", 1);
1054 tstNumOp(pDbgc, "---1", UINT64_MAX);
1055 tstNumOp(pDbgc, "----1", 1);
1057 tstNumOp(pDbgc, "~0", UINT64_MAX);
1058 tstNumOp(pDbgc, "~1", UINT64_MAX-1);
1059 tstNumOp(pDbgc, "~~0", 0);
1060 tstNumOp(pDbgc, "~~1", 1);
1062 tstNumOp(pDbgc, "!1", 0);
1063 tstNumOp(pDbgc, "!0", 1);
1064 tstNumOp(pDbgc, "!42", 0);
1065 tstNumOp(pDbgc, "!!42", 1);
1066 tstNumOp(pDbgc, "!!!42", 0);
1067 tstNumOp(pDbgc, "!!!!42", 1);
1069 tstNumOp(pDbgc, "1 +1", 2);
1070 tstNumOp(pDbgc, "1 + 1", 2);
1071 tstNumOp(pDbgc, "1+1", 2);
1072 tstNumOp(pDbgc, "1+ 1", 2);
1074 tstNumOp(pDbgc, "1 - 1", 0);
1075 tstNumOp(pDbgc, "99 - 90", 9);
1077 tstNumOp(pDbgc, "2 * 2", 4);
1079 tstNumOp(pDbgc, "2 / 2", 1);
1080 tstNumOp(pDbgc, "2 / 0", UINT64_MAX);
1081 tstNumOp(pDbgc, "0i1024 / 0i4", 256);
1083 tstNumOp(pDbgc, "8 mod 7", 1);
1085 tstNumOp(pDbgc, "1<<1", 2);
1086 tstNumOp(pDbgc, "1<<0i32", UINT64_C(0x0000000100000000));
1087 tstNumOp(pDbgc, "1<<0i48", UINT64_C(0x0001000000000000));
1088 tstNumOp(pDbgc, "1<<0i63", UINT64_C(0x8000000000000000));
1090 tstNumOp(pDbgc, "fedcba0987654321>>0i04", UINT64_C(0x0fedcba098765432));
1091 tstNumOp(pDbgc, "fedcba0987654321>>0i32", UINT64_C(0xfedcba09));
1092 tstNumOp(pDbgc, "fedcba0987654321>>0i48", UINT64_C(0x0000fedc));
1094 tstNumOp(pDbgc, "0ef & 4", 4);
1095 tstNumOp(pDbgc, "01234567891 & fff", UINT64_C(0x00000000891));
1096 tstNumOp(pDbgc, "01234567891 & ~fff", UINT64_C(0x01234567000));
1098 tstNumOp(pDbgc, "1 | 1", 1);
1099 tstNumOp(pDbgc, "0 | 4", 4);
1100 tstNumOp(pDbgc, "4 | 0", 4);
1101 tstNumOp(pDbgc, "4 | 4", 4);
1102 tstNumOp(pDbgc, "1 | 4 | 2", 7);
1104 tstNumOp(pDbgc, "1 ^ 1", 0);
1105 tstNumOp(pDbgc, "1 ^ 0", 1);
1106 tstNumOp(pDbgc, "0 ^ 1", 1);
1107 tstNumOp(pDbgc, "3 ^ 1", 2);
1108 tstNumOp(pDbgc, "7 ^ 3", 4);
1110 tstNumOp(pDbgc, "7 || 3", 1);
1111 tstNumOp(pDbgc, "1 || 0", 1);
1112 tstNumOp(pDbgc, "0 || 1", 1);
1113 tstNumOp(pDbgc, "0 || 0", 0);
1115 tstNumOp(pDbgc, "0 && 0", 0);
1116 tstNumOp(pDbgc, "1 && 0", 0);
1117 tstNumOp(pDbgc, "0 && 1", 0);
1118 tstNumOp(pDbgc, "1 && 1", 1);
1119 tstNumOp(pDbgc, "4 && 1", 1);
1123 static void testBasicsFundametalParsing(PDBGC pDbgc)
1126 tstTry(pDbgc, "stop\n", VINF_SUCCESS);
1127 tstTry(pDbgc, "format 1\n", VINF_SUCCESS);
1128 tstTry(pDbgc, "format \n", VERR_DBGC_PARSE_TOO_FEW_ARGUMENTS);
1129 tstTry(pDbgc, "format 0 1 23 4\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
1130 tstTry(pDbgc, "format 'x'\n", VINF_SUCCESS);
1131 tstTry(pDbgc, "format 'x' 'x'\n", VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS);
1132 tstTry(pDbgc, "format 'x''x'\n", VINF_SUCCESS);
1133 tstTry(pDbgc, "format 'x'\"x\"\n", VERR_DBGC_PARSE_EXPECTED_BINARY_OP);
1134 tstTry(pDbgc, "format 'x'1\n", VERR_DBGC_PARSE_EXPECTED_BINARY_OP);
1135 tstTry(pDbgc, "format (1)1\n", VERR_DBGC_PARSE_EXPECTED_BINARY_OP);
1136 tstTry(pDbgc, "format (1)(1)\n", VERR_DBGC_PARSE_EXPECTED_BINARY_OP);
1137 tstTry(pDbgc, "format (1)''\n", VERR_DBGC_PARSE_EXPECTED_BINARY_OP);
1138 tstTry(pDbgc, "format nosuchfunction(1)\n", VERR_DBGC_PARSE_FUNCTION_NOT_FOUND);
1139 tstTry(pDbgc, "format nosuchfunction(1,2,3)\n", VERR_DBGC_PARSE_FUNCTION_NOT_FOUND);
1140 tstTry(pDbgc, "format nosuchfunction()\n", VERR_DBGC_PARSE_FUNCTION_NOT_FOUND);
1141 tstTry(pDbgc, "format randu32()\n", VINF_SUCCESS);
1142 tstTryEx(pDbgc, "format %0\n", VINF_SUCCESS, false, "Guest flat address: %00000000", -1);
1143 tstTryEx(pDbgc, "format %eax\n", VINF_SUCCESS, false, "Guest flat address: %cafebabe", -1);
1144 tstTry(pDbgc, "sa 3 23 4 'q' \"21123123\" 'b' \n", VINF_SUCCESS);
1145 tstTry(pDbgc, "sa 3,23, 4,'q' ,\"21123123\" , 'b' \n", VINF_SUCCESS);
1163 PDBGC pDbgc;
1164 rc = dbgcCreate(&pDbgc, &g_tstBack, 0);
1167 pDbgc->pVM = (PVM)pDbgc;
1168 rc = dbgcProcessInput(pDbgc, true /* fNoExecute */);
1175 testBasicsFundametalParsing(pDbgc);
1177 testBasicsOperators(pDbgc);
1179 testBasicsOddCases(pDbgc);
1186 testCodeView_ba(pDbgc);
1187 testCodeView_bc(pDbgc);
1188 testCodeView_bd(pDbgc);
1189 testCodeView_be(pDbgc);
1190 testCodeView_bl(pDbgc);
1191 testCodeView_bp(pDbgc);
1192 testCodeView_br(pDbgc);
1193 testCodeView_d(pDbgc);
1194 testCodeView_da(pDbgc);
1195 testCodeView_db(pDbgc);
1196 testCodeView_dd(pDbgc);
1197 testCodeView_dg(pDbgc);
1198 testCodeView_dga(pDbgc);
1199 testCodeView_di(pDbgc);
1200 testCodeView_dia(pDbgc);
1201 testCodeView_dl(pDbgc);
1202 testCodeView_dla(pDbgc);
1203 testCodeView_dpd(pDbgc);
1204 testCodeView_dpda(pDbgc);
1205 testCodeView_dpdb(pDbgc);
1206 testCodeView_dpdg(pDbgc);
1207 testCodeView_dpdh(pDbgc);
1208 testCodeView_dph(pDbgc);
1209 testCodeView_dphg(pDbgc);
1210 testCodeView_dphh(pDbgc);
1211 testCodeView_dq(pDbgc);
1212 testCodeView_dt(pDbgc);
1213 testCodeView_dt16(pDbgc);
1214 testCodeView_dt32(pDbgc);
1215 testCodeView_dt64(pDbgc);
1216 testCodeView_dw(pDbgc);
1217 testCodeView_eb(pDbgc);
1218 testCodeView_ew(pDbgc);
1219 testCodeView_ed(pDbgc);
1220 testCodeView_eq(pDbgc);
1221 testCodeView_g(pDbgc);
1222 testCodeView_k(pDbgc);
1223 testCodeView_kg(pDbgc);
1224 testCodeView_kh(pDbgc);
1225 testCodeView_lm(pDbgc);
1226 testCodeView_lmo(pDbgc);
1227 testCodeView_ln(pDbgc);
1228 testCodeView_ls(pDbgc);
1229 testCodeView_m(pDbgc);
1230 testCodeView_r(pDbgc);
1231 testCodeView_rg(pDbgc);
1232 testCodeView_rg32(pDbgc);
1233 testCodeView_rg64(pDbgc);
1234 testCodeView_rh(pDbgc);
1235 testCodeView_rt(pDbgc);
1236 testCodeView_s(pDbgc);
1237 testCodeView_sa(pDbgc);
1238 testCodeView_sb(pDbgc);
1239 testCodeView_sd(pDbgc);
1240 testCodeView_sq(pDbgc);
1241 testCodeView_su(pDbgc);
1242 testCodeView_sw(pDbgc);
1243 testCodeView_t(pDbgc);
1244 testCodeView_y(pDbgc);
1245 testCodeView_u64(pDbgc);
1246 testCodeView_u32(pDbgc);
1247 testCodeView_u16(pDbgc);
1248 testCodeView_uv86(pDbgc);
1250 testCommon_bye_exit_quit(pDbgc);
1251 testCommon_cpu(pDbgc);
1252 testCommon_echo(pDbgc);
1253 testCommon_format(pDbgc);
1254 testCommon_detect(pDbgc);
1255 testCommon_harakiri(pDbgc);
1256 testCommon_help(pDbgc);
1257 testCommon_info(pDbgc);
1258 testCommon_loadimage(pDbgc);
1259 testCommon_loadmap(pDbgc);
1260 testCommon_loadplugin(pDbgc);
1261 testCommon_loadseg(pDbgc);
1262 testCommon_loadsyms(pDbgc);
1263 testCommon_loadvars(pDbgc);
1264 testCommon_log(pDbgc);
1265 testCommon_logdest(pDbgc);
1266 testCommon_logflags(pDbgc);
1267 testCommon_runscript(pDbgc);
1268 testCommon_set(pDbgc);
1269 testCommon_showplugins(pDbgc);
1270 testCommon_showvars(pDbgc);
1271 testCommon_stop(pDbgc);
1272 testCommon_unloadplugin(pDbgc);
1273 testCommon_unset(pDbgc);
1274 testCommon_writecore(pDbgc);
1278 dbgcDestroy(pDbgc);