96 #include "floatformat.h" 109 #include <sys/utsname.h> 114 #include <sys/farptr.h> 115 #include <debug/v2load.h> 116 #include <debug/dbgcom.h> 117 #if __DJGPP_MINOR__ > 2 118 #include <debug/redir.h> 123 #if __DJGPP_MINOR__ < 3 162 asm (
"inb $0xa0, %%al \n\ 163 testb $0x20, %%al \n\ 187 asm (
"frstor %0":
"=m" (
npx));
237 #define r_ofs(x) (offsetof(TSS,x)) 246 {
r_ofs (tss_eax), 4},
247 {
r_ofs (tss_ecx), 4},
248 {
r_ofs (tss_edx), 4},
249 {
r_ofs (tss_ebx), 4},
250 {
r_ofs (tss_esp), 4},
251 {
r_ofs (tss_ebp), 4},
252 {
r_ofs (tss_esi), 4},
253 {
r_ofs (tss_edi), 4},
254 {
r_ofs (tss_eip), 4},
255 {
r_ofs (tss_eflags), 4},
290 {1, GDB_SIGNAL_TRAP},
295 {3, GDB_SIGNAL_TRAP},
297 {5, GDB_SIGNAL_SEGV},
300 {8, GDB_SIGNAL_SEGV},
301 {9, GDB_SIGNAL_SEGV},
302 {10, GDB_SIGNAL_BUS},
303 {11, GDB_SIGNAL_SEGV},
304 {12, GDB_SIGNAL_SEGV},
305 {13, GDB_SIGNAL_SEGV},
306 {14, GDB_SIGNAL_SEGV},
307 {16, GDB_SIGNAL_FPE},
308 {17, GDB_SIGNAL_BUS},
309 {31, GDB_SIGNAL_ILL},
310 {0x1b, GDB_SIGNAL_INT},
311 {0x75, GDB_SIGNAL_FPE},
312 {0x78, GDB_SIGNAL_ALRM},
313 {0x79, GDB_SIGNAL_INT},
314 {0x7a, GDB_SIGNAL_QUIT},
315 {-1, GDB_SIGNAL_LAST}
325 {GDB_SIGNAL_SEGV, 13},
326 {GDB_SIGNAL_BUS, 17},
329 {GDB_SIGNAL_TERM, 0x1b},
330 {GDB_SIGNAL_FPE, 0x75},
331 {GDB_SIGNAL_INT, 0x79},
332 {GDB_SIGNAL_QUIT, 0x7a},
333 {GDB_SIGNAL_ALRM, 0x78},
334 {GDB_SIGNAL_PROF, 0x78},
335 {GDB_SIGNAL_LAST, -1}
342 You cannot attach to a running program on this platform.\n\ 343 Use the `run' command to run DJGPP programs."));
351 ptid_t ptid,
int step,
enum gdb_signal siggnal)
357 if (siggnal != GDB_SIGNAL_0 && siggnal != GDB_SIGNAL_TRAP)
360 excepn_map[i].gdb_sig != GDB_SIGNAL_LAST; i++)
379 unsigned char saved_opcode;
380 unsigned long INT3_addr = 0;
381 int stepping_over_INT = 0;
383 a_tss.tss_eflags &= 0xfeff;
400 read_child (a_tss.tss_eip, &saved_opcode, 1);
401 if (saved_opcode == 0xCD || saved_opcode == 0xCE)
403 unsigned char INT3_opcode = 0xCC;
406 = saved_opcode == 0xCD ? a_tss.tss_eip + 2 : a_tss.tss_eip + 1;
407 stepping_over_INT = 1;
408 read_child (INT3_addr, &saved_opcode, 1);
409 write_child (INT3_addr, &INT3_opcode, 1);
412 a_tss.tss_eflags |= 0x0100;
420 a_tss.tss_irqn = 0xff;
424 a_tss.tss_trap = 0xffff;
444 #if __DJGPP_MINOR__ < 3 448 #if __DJGPP_MINOR__ < 3 453 if (stepping_over_INT && a_tss.tss_eip == INT3_addr + 1)
457 write_child (a_tss.tss_eip, &saved_opcode, 1);
460 a_tss.tss_eflags |= 0x0100;
466 if (a_tss.tss_irqn == 0x21)
469 status->value.integer = a_tss.tss_eax & 0xff;
473 status->value.sig = GDB_SIGNAL_UNKNOWN;
475 for (i = 0;
sig_map[i].go32_sig != -1; i++)
477 if (a_tss.tss_irqn ==
sig_map[i].go32_sig)
479 #if __DJGPP_MINOR__ < 3 505 _(
"Invalid register no. %d in fetch_register."), regno);
536 _(
"Invalid register no. %d in store_register."), regno);
561 static void *
buffer = NULL;
562 static unsigned buffer_len = 0;
565 if (buffer_len < len)
571 memcpy (
buffer, buf, len);
572 res = write_child (child_addr,
buffer, len);
585 if (writebuf != NULL)
588 res = read_child (memaddr, readbuf, len);
603 const char *annex,
gdb_byte *readbuf,
614 readbuf, writebuf,
offset, len,
635 const char *exec_file,
636 const std::string &allargs,
char **env,
int from_tty)
645 const char *
args = allargs.c_str ();
662 _(
"Cannot allocate redirection storage: " 663 "not enough memory.\n"));
666 if (strpbrk (
args,
"<>"))
671 error (
_(
"Syntax error in command line."));
676 cmdlen = strlen (
args);
679 if (cmdlen > 1024*1024)
680 error (
_(
"Command line too long."));
682 cmdline = (
char *)
xmalloc (cmdlen + 4);
683 strcpy (cmdline + 1,
args);
689 cmdline[0] = strlen (
args);
690 cmdline[cmdlen + 1] = 13;
697 result = v2loadimage (exec_file, cmdline, start_state);
703 error (
_(
"Load failed for image %s"), exec_file);
705 edi_init (start_state);
706 #if __DJGPP_MINOR__ < 3 755 #define D_REGS edi.dr 756 #define CONTROL D_REGS[7] 757 #define STATUS D_REGS[6] 767 _(
"Invalid register %d in go32_set_dr.\n"), i);
808 _(
"Invalid register %d in go32_get_dr.\n"), i);
818 int oldmode, newmode;
823 __dpmi_int (0x21, ®s);
824 if (regs.x.flags & 1)
826 newmode = oldmode = regs.x.dx;
837 regs.x.dx = newmode & 0xff;
838 __dpmi_int (0x21, ®s);
839 if (regs.x.flags & 1)
842 return (oldmode & 0x20) == 0x20;
869 #if __DJGPP_MINOR__ > 2 874 for (i = 0; i < DBG_HANDLES; i++)
879 else if (_get_dev_info (
child_cmd.redirection[i]->inf_handle) == -1)
881 (
"\tFile handle %d appears to be closed by inferior.\n", i);
883 else if ((_get_dev_info (
child_cmd.redirection[i]->inf_handle) & 0xdf)
884 != (_get_dev_info (i) & 0xdf))
886 (
"\tFile handle %d appears to be redirected by inferior.\n", i);
900 error (
_(
"Cannot redirect standard handles for program: %s."),
934 error (
_(
"Cannot redirect standard handles for debugger: %s."),
987 __dpmi_int (0x21, ®s);
988 if (!(regs.x.flags & 1))
989 return regs.x.bx & 0xffff;
1006 int blen =
sizeof (buf);
1007 int needed = snprintf (buf, blen,
"CP%d",
dos_codepage ());
1011 retval = xstrdup (buf);
1015 retval = xstrdup (
"");
1030 __dpmi_int(0x2f, &r);
1031 if (r.h.al > 2 && r.h.al != 0x80 && r.h.al != 0xff
1032 && (r.h.al > 3 || r.h.ah > 0))
1043 print_mem (
unsigned long datum,
const char *header,
int in_pages_p)
1045 if (datum != 0xffffffffUL)
1053 if (datum > 1024 * 1024)
1066 static const char test_pattern[] =
1067 "deadbeafdeadbeafdeadbeafdeadbeafdeadbeaf" 1068 "deadbeafdeadbeafdeadbeafdeadbeafdeadbeaf" 1069 "deadbeafdeadbeafdeadbeafdeadbeafdeadbeafdeadbeaf";
1071 char cpuid_vendor[13];
1072 unsigned cpuid_max = 0, cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
1073 unsigned true_dos_version = _get_dos_version (1);
1074 unsigned advertized_dos_version = ((
unsigned int)_osmajor << 8) | _osminor;
1076 char dpmi_vendor_info[129];
1077 int dpmi_vendor_available;
1078 __dpmi_version_ret dpmi_version_data;
1080 __dpmi_free_mem_info mem_info;
1083 cpuid_vendor[0] =
'\0';
1085 strcpy (u.machine,
"Unknown x86");
1086 else if (u.machine[0] ==
'i' && u.machine[1] > 4)
1093 unsigned int eax, ebx, ecx, edx;
1095 if (
x86_cpuid (0, &eax, &ebx, &ecx, &edx))
1098 memcpy (&vendor[0], &ebx, 4);
1099 memcpy (&vendor[4], &ecx, 4);
1100 memcpy (&vendor[8], &edx, 4);
1101 cpuid_vendor[12] =
'\0';
1104 __asm__ __volatile__ (
"xorl %%ebx, %%ebx;" 1105 "xorl %%ecx, %%ecx;" 1106 "xorl %%edx, %%edx;" 1113 :
"=m" (cpuid_vendor[0]),
1114 "=m" (cpuid_vendor[4]),
1115 "=m" (cpuid_vendor[8]),
1118 :
"%eax",
"%ebx",
"%ecx",
"%edx");
1119 cpuid_vendor[12] =
'\0';
1124 if (cpuid_vendor[0])
1131 static const char *brand_name[] = {
1139 char cpu_string[80];
1142 int intel_p = strcmp (cpuid_vendor,
"GenuineIntel") == 0;
1143 int amd_p = strcmp (cpuid_vendor,
"AuthenticAMD") == 0;
1144 unsigned cpu_family, cpu_model;
1148 x86_cpuid (1, &cpuid_eax, &cpuid_ebx, NULL, &cpuid_edx);
1150 __asm__ __volatile__ (
"movl $1, %%eax;" 1158 brand_idx = cpuid_ebx & 0xff;
1159 cpu_family = (cpuid_eax >> 8) & 0xf;
1160 cpu_model = (cpuid_eax >> 4) & 0xf;
1161 cpu_brand[0] =
'\0';
1165 && brand_idx <
sizeof(brand_name)/
sizeof(brand_name[0])
1166 && *brand_name[brand_idx])
1167 strcpy (cpu_brand, brand_name[brand_idx]);
1168 else if (cpu_family == 5)
1170 if (((cpuid_eax >> 12) & 3) == 0 && cpu_model == 4)
1171 strcpy (cpu_brand,
" MMX");
1172 else if (cpu_model > 1 && ((cpuid_eax >> 12) & 3) == 1)
1173 strcpy (cpu_brand,
" OverDrive");
1174 else if (cpu_model > 1 && ((cpuid_eax >> 12) & 3) == 2)
1175 strcpy (cpu_brand,
" Dual");
1177 else if (cpu_family == 6 && cpu_model < 8)
1182 strcpy (cpu_brand,
" Pro");
1185 strcpy (cpu_brand,
" II");
1188 strcpy (cpu_brand,
" II Xeon");
1191 strcpy (cpu_brand,
" Celeron");
1194 strcpy (cpu_brand,
" III");
1204 strcpy (cpu_brand,
"486/5x86");
1213 strcpy (cpu_brand,
"-K5");
1217 strcpy (cpu_brand,
"-K6");
1220 strcpy (cpu_brand,
"-K6-2");
1223 strcpy (cpu_brand,
"-K6-III");
1233 strcpy (cpu_brand,
" Athlon");
1236 strcpy (cpu_brand,
" Duron");
1242 xsnprintf (cpu_string,
sizeof (cpu_string),
"%s%s Model %d Stepping %d",
1243 intel_p ?
"Pentium" : (amd_p ?
"AMD" :
"ix86"),
1244 cpu_brand, cpu_model, cpuid_eax & 0xf);
1246 if (((cpuid_edx & (6 | (0x0d << 23))) != 0)
1247 || ((cpuid_edx & 1) == 0)
1248 || (amd_p && (cpuid_edx & (3 << 30)) != 0))
1253 if ((cpuid_edx & 1) == 0)
1255 if ((cpuid_edx & (1 << 1)) != 0)
1257 if ((cpuid_edx & (1 << 2)) != 0)
1259 if ((cpuid_edx & (1 << 4)) != 0)
1261 if ((cpuid_edx & (1 << 23)) != 0)
1263 if ((cpuid_edx & (1 << 25)) != 0)
1265 if ((cpuid_edx & (1 << 26)) != 0)
1269 if ((cpuid_edx & (1 << 31)) != 0)
1271 if ((cpuid_edx & (1 << 30)) != 0)
1279 _os_flavor, u.release, u.version);
1280 if (true_dos_version != advertized_dos_version)
1287 const char *windows_flavor;
1294 windows_flavor =
"3.X";
1300 windows_flavor =
"95, 95A, or 95B";
1303 windows_flavor =
"95B OSR2.1 or 95C OSR2.5";
1306 windows_flavor =
"98 or 98 SE";
1309 windows_flavor =
"ME";
1312 windows_flavor =
"9X";
1317 windows_flavor =
"??";
1322 else if (true_dos_version == 0x532 && advertized_dos_version == 0x500)
1324 "Windows NT family (W2K/XP/W2K3/Vista/W2K8)\n");
1329 memcpy (dpmi_vendor_info, test_pattern,
sizeof(dpmi_vendor_info));
1330 dpmi_vendor_available =
1331 __dpmi_get_capabilities (&dpmi_flags, dpmi_vendor_info);
1332 if (dpmi_vendor_available == 0
1333 && memcmp (dpmi_vendor_info, test_pattern,
1334 sizeof(dpmi_vendor_info)) != 0)
1338 if (!memchr (&dpmi_vendor_info[2], 0, 126))
1339 dpmi_vendor_info[128] =
'\0';
1341 "%s v%d.%d (capabilities: %#x)\n",
1342 &dpmi_vendor_info[2],
1343 (
unsigned)dpmi_vendor_info[0],
1344 (
unsigned)dpmi_vendor_info[1],
1345 ((
unsigned)dpmi_flags & 0x7f));
1348 printf_filtered (
"DPMI Host......................(Info not available)\n");
1349 __dpmi_get_version (&dpmi_version_data);
1351 dpmi_version_data.major, dpmi_version_data.minor);
1353 "%s-bit DPMI, with%s Virtual Memory support\n",
1354 (dpmi_version_data.flags & 1) ?
"32" :
"16",
1355 (dpmi_version_data.flags & 4) ?
"" :
"out");
1357 (dpmi_version_data.flags & 2) ?
"V86" :
"Real");
1359 dpmi_version_data.cpu);
1361 dpmi_version_data.master_pic, dpmi_version_data.slave_pic);
1366 __asm__ __volatile__ (
"pushfl ; popl %0" :
"=g" (eflags));
1368 "Ring %d (in %s), with%s I/O protection\n",
1369 a_tss.tss_cs & 3, (a_tss.tss_cs & 4) ?
"LDT" :
"GDT",
1370 (a_tss.tss_cs & 3) > ((eflags >> 12) & 3) ?
"" :
"out");
1373 __dpmi_get_free_memory_information (&mem_info);
1374 print_mem (mem_info.total_number_of_physical_pages,
1375 "DPMI Total Physical Memory.....", 1);
1376 print_mem (mem_info.total_number_of_free_pages,
1377 "DPMI Free Physical Memory......", 1);
1378 print_mem (mem_info.size_of_paging_file_partition_in_pages,
1379 "DPMI Swap Space................", 1);
1380 print_mem (mem_info.linear_address_space_size_in_pages,
1381 "DPMI Total Linear Address Size.", 1);
1382 print_mem (mem_info.free_linear_address_space_in_pages,
1383 "DPMI Free Linear Address Size..", 1);
1384 print_mem (mem_info.largest_available_free_block_in_bytes,
1385 "DPMI Largest Free Memory Block.", 0);
1389 __dpmi_int (0x21, ®s);
1390 print_mem (regs.x.bx << 4,
"Free DOS Memory................", 0);
1392 __dpmi_int (0x21, ®s);
1393 if ((regs.x.flags & 1) == 0)
1395 static const char *dos_hilo[] = {
1396 "Low",
"",
"",
"",
"High",
"",
"",
"",
"High, then Low" 1398 static const char *dos_fit[] = {
1399 "First",
"Best",
"Last" 1401 int hilo_idx = (regs.x.ax >> 4) & 0x0f;
1402 int fit_idx = regs.x.ax & 0x0f;
1408 printf_filtered (
"DOS Memory Allocation..........%s memory, %s fit\n",
1409 dos_hilo[hilo_idx], dos_fit[fit_idx]);
1411 __dpmi_int (0x21, ®s);
1412 if ((regs.x.flags & 1) != 0)
1415 regs.h.al == 0 ?
"not " :
"");
1450 unsigned long dos_ds_limit = __dpmi_get_segment_limit (_dos_ds);
1454 if (addr <= dos_ds_limit - len)
1455 dosmemget (addr, len, dest);
1460 int sel = __dpmi_allocate_ldt_descriptors (1);
1466 int access_rights = __dpmi_get_descriptor_access_rights (sel);
1467 size_t segment_limit = len - 1;
1475 if (len > 1024 * 1024)
1477 access_rights |= 0x8000;
1480 segment_limit |= 0xfff;
1483 access_rights &= ~0x8000;
1485 if (__dpmi_set_segment_base_address (sel, addr) != -1
1486 && __dpmi_set_descriptor_access_rights (sel, access_rights) != -1
1487 && __dpmi_set_segment_limit (sel, segment_limit) != -1
1490 && __dpmi_get_segment_limit (sel) >= segment_limit)
1491 movedata (sel, 0, _my_ds (), (
unsigned)dest, len);
1495 __dpmi_free_ldt_descriptor (sel);
1507 unsigned long addr = table_base + idx * 8;
1510 return (
int)((
struct seg_descr *)descr)->stype;
1529 if (idx == 0 &&
type == 0)
1535 static unsigned allowed_descriptors[] = {
1544 unsigned long limit = (descr.
limit1 << 16) | descr.
limit0;
1547 && (allowed_descriptors[
type] & (1 << descr.
stype)) != 0)
1551 ? idx : (idx * 8) | (
type ? (cpl | 4) : 0));
1553 limit = (limit << 12) | 0xfff;
1560 switch (descr.
stype)
1565 descr.
stype == 3 ?
"" :
"in");
1571 memcpy (&gate, &descr,
sizeof gate);
1583 memcpy (&gate, &descr,
sizeof gate);
1587 descr.
stype == 6 ?
"Interrupt" :
"Trap");
1592 descr.
stype == 3 ?
"" :
"in");
1595 memcpy (&gate, &descr,
sizeof gate);
1603 memcpy (&gate, &descr,
sizeof gate);
1607 descr.
stype == 14 ?
"Interrupt" :
"Trap");
1618 descr.
bit32 ?
"32" :
"16",
1620 ?
"Read/Write," :
"Read-Only, ",
1621 descr.
stype & 4 ?
"down" :
"up",
1622 descr.
stype & 1 ?
"" :
", N.Acc");
1633 descr.
bit32 ?
"32" :
"16",
1634 descr.
stype & 2 ?
"Exec/Read" :
"Exec-Only",
1635 descr.
stype & 4 ?
"" :
"N.",
1636 descr.
stype & 1 ?
"" :
", N.Acc");
1648 ? idx : (idx * 8) | (
type ? (cpl | 4) : 0));
1664 unsigned short ldtr = 0;
1667 long ldt_entry = -1
L;
1678 || (ldt_entry & 4) == 0
1679 || (ldt_entry & 3) != (cpl & 3))
1680 error (
_(
"Invalid LDT entry 0x%03lx."), (
unsigned long)ldt_entry);
1684 __asm__ __volatile__ (
"sgdt %0" :
"=m" (gdtr) : );
1685 __asm__ __volatile__ (
"sldt %0" :
"=m" (ldtr) : );
1693 | (ldt_descr.
base1 << 16)
1694 | (ldt_descr.
base2 << 24));
1699 | (ldt_descr.
base1 << 16)
1700 | (ldt_descr.
base2 << 24);
1701 unsigned limit = ldt_descr.
limit0 | (ldt_descr.
limit1 << 16);
1707 limit = (limit << 12) | 0xfff;
1713 max_entry = (limit + 1) / 8;
1717 if (ldt_entry > limit)
1718 error (
_(
"Invalid LDT entry %#lx: outside valid limits [0..%#x]"),
1719 (
unsigned long)ldt_entry, limit);
1727 for (i = 0; i < max_entry; i++)
1737 long gdt_entry = -1
L;
1747 if (gdt_entry < 0 || (gdt_entry & 7) != 0)
1748 error (
_(
"Invalid GDT entry 0x%03lx: " 1749 "not an integral multiple of 8."),
1750 (
unsigned long)gdt_entry);
1754 __asm__ __volatile__ (
"sgdt %0" :
"=m" (gdtr) : );
1755 max_entry = (gdtr.limit + 1) / 8;
1759 if (gdt_entry > gdtr.limit)
1760 error (
_(
"Invalid GDT entry %#lx: outside valid limits [0..%#x]"),
1761 (
unsigned long)gdt_entry, gdtr.limit);
1769 for (i = 0; i < max_entry; i++)
1778 long idt_entry = -1
L;
1789 error (
_(
"Invalid (negative) IDT entry %ld."), idt_entry);
1793 __asm__ __volatile__ (
"sidt %0" :
"=m" (idtr) : );
1794 max_entry = (idtr.limit + 1) / 8;
1795 if (max_entry > 0x100)
1800 if (idt_entry > idtr.limit)
1801 error (
_(
"Invalid IDT entry %#lx: outside valid limits [0..%#x]"),
1802 (
unsigned long)idt_entry, idtr.limit);
1810 for (i = 0; i < max_entry; i++)
1820 static unsigned long 1825 unsigned long taskbase, cr3;
1832 __asm__ __volatile__ (
"sgdt %0" :
"=m" (gdtr) : );
1833 __asm__ __volatile__ (
"str %0" :
"=m" (taskreg) : );
1840 offset = gdtr.base + (taskreg & 0xfff8) + 2;
1847 _farsetsel (_dos_ds);
1848 taskbase = _farnspeekl (
offset) & 0xffffffU;
1849 taskbase += _farnspeekl (
offset + 2) & 0xff000000U;
1850 if (taskbase > 0xfffff)
1855 cr3 = _farnspeekl (taskbase + 0x1c) & ~0xfff;
1865 unsigned long addr, pte_idx;
1867 for (addr = 0xb0000, pte_idx = 0xb0;
1869 addr += 0x1000, pte_idx++)
1871 if (((_farnspeekl (addr + 4 * pte_idx) & 0xfffff027) ==
1872 (_farnspeekl (addr + 0x1000) & 0xfffff027))
1873 && ((_farnspeekl (addr + 4 * pte_idx + 4) & 0xfffff000) == cr3))
1875 cr3 = addr + 0x1000;
1889 static unsigned long 1892 unsigned long pde = 0;
1894 if (
pdbr && n >= 0 && n < 1024)
1896 pde = _farpeekl (_dos_ds,
pdbr + 4*n);
1903 static unsigned long 1906 unsigned long pte = 0;
1910 if ((pde & 1) && !(pde & 0x80) && n >= 0 && n < 1024)
1913 pte = _farpeekl (_dos_ds, pde + 4*n);
1925 if ((entry & 1) != 0)
1928 if ((entry & 0x100) && !is_dir)
1930 if ((entry & 0x40) && !is_dir)
1942 printf_filtered (
"Page%s not present or not supported; value=0x%lx.\n",
1943 is_dir ?
" Table" :
"", entry >> 1);
1949 long pde_idx = -1, i;
1958 if (pde_idx < 0 || pde_idx >= 1024)
1959 error (
_(
"Entry %ld is outside valid limits [0..1023]."), pde_idx);
1966 "not supported on this system.\n");
1967 else if (pde_idx >= 0)
1970 for (i = 0; i < 1024; i++)
1980 unsigned long pde =
get_pde (n);
1987 "Page Directory entry 0x%lx:\n", n);
1988 for (i = 0; i < 1024; i++)
1999 long pde_idx = -1
L, i;
2008 if (pde_idx < 0 || pde_idx >= 1024)
2009 error (
_(
"Entry %ld is outside valid limits [0..1023]."), pde_idx);
2015 puts_filtered (
"Access to Page Tables is not supported on this system.\n");
2016 else if (pde_idx >= 0)
2019 for (i = 0; i < 1024; i++)
2040 puts_filtered (
"Access to Page Tables is not supported on this system.\n");
2043 int pde_idx = (addr >> 22) & 0x3ff;
2044 int pte_idx = (addr >> 12) & 0x3ff;
2045 unsigned offs = addr & 0xfff;
2083 _(
"Cannot allocate redirection storage: " 2084 "not enough memory.\n"));
2090 Print information specific to DJGPP (aka MS-DOS) debugging."),
2094 Display information about the target system, including CPU, OS, DPMI, etc."),
2097 Display entries in the LDT (Local Descriptor Table).\n\ 2098 Entry number (an expression) as an argument means display only that entry."),
2101 Display entries in the GDT (Global Descriptor Table).\n\ 2102 Entry number (an expression) as an argument means display only that entry."),
2105 Display entries in the IDT (Interrupt Descriptor Table).\n\ 2106 Entry number (an expression) as an argument means display only that entry."),
2109 Display entries in the Page Directory.\n\ 2110 Entry number (an expression) as an argument means display only that entry."),
2113 Display entries in Page Tables.\n\ 2114 Entry number (an expression) as an argument means display only entries\n\ 2115 from the Page Table pointed to by the specified Page Directory entry."),
2118 Display a Page Table entry for a linear address.\n\ 2119 The address argument must be a linear address, after adding to\n\ 2120 it the base address of the appropriate segment.\n\ 2121 The base address of variables and functions in the debuggee's data\n\ 2122 or code segment is stored in the variable __djgpp_base_address,\n\ 2123 so use `__djgpp_base_address + (char *)&var' as the argument.\n\ 2124 For other segments, look up their base address in the output of\n\ 2125 the `info dos ldt' command."),
2141 if (isatty (fd) && pgid ==
SOME_PID)
2143 errno = pgid ==
SOME_PID ? ENOTTY : ENOSYS;
void error_no_arg(const char *why)
void add_target(struct target_ops *t)
void i387_collect_fsave(const struct regcache *regcache, int regnum, void *fsave)
static int go32_thread_alive(struct target_ops *ops, ptid_t ptid)
char * hex_string(LONGEST num)
static int read_memory_region(unsigned long addr, void *dest, size_t len)
static void display_descriptor(unsigned type, unsigned long base_addr, int idx, int force)
static __inline int x86_cpuid(unsigned int __level, unsigned int *__eax, unsigned int *__ebx, unsigned int *__ecx, unsigned int *__edx)
int redir_debug_init(cmdline_t *ptr)
static ptid_t go32_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *status, int options)
static void go32_set_dr7(unsigned long val)
unsigned short windows_minor
static void load_npx(void)
static void go32_info_dos_command(const char *args, int from_tty)
static void go32_store_registers(struct target_ops *ops, struct regcache *regcache, int regno)
void insert_breakpoints(void)
static int resume_is_step
static void print_mem(unsigned long datum, const char *header, int in_pages_p)
static void go32_fetch_registers(struct target_ops *ops, struct regcache *regcache, int regno)
static unsigned long go32_get_dr7(void)
static int terminal_is_ours
EXTERN unsigned char processing_gcc_compilation
static void go32_set_dr(int i, CORE_ADDR addr)
void(* to_terminal_init)(struct target_ops *) TARGET_DEFAULT_IGNORE()
void push_target(struct target_ops *t)
void delete_thread_silent(ptid_t)
char * get_exec_file(int err)
static void display_ptable_entry(unsigned long entry, int is_dir, int force, unsigned off)
static void go32_terminal_info(struct target_ops *self, const char *args, int from_tty)
void internal_error(const char *file, int line, const char *fmt,...)
void(* to_terminal_ours_for_output)(struct target_ops *) TARGET_DEFAULT_IGNORE()
static int dr_ref_count[4]
void generic_mourn_inferior(void)
const char *(* to_pid_to_str)(struct target_ops *, ptid_t) TARGET_DEFAULT_FUNC(default_pid_to_str)
static int inf_terminal_mode
void _initialize_go32_nat(void)
static void display_page_table(long n, int force)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
int i386_fp_regnum_p(struct gdbarch *gdbarch, int regnum)
static struct @71 sig_map[]
static void go32_sysinfo(const char *arg, int from_tty)
void i387_supply_fsave(struct regcache *regcache, int regnum, const void *fsave)
char * skip_spaces(char *chp)
static CORE_ADDR go32_get_dr(int i)
void(* set_control)(unsigned long)
static void go32_pte(const char *arg, int from_tty)
int redir_to_debugger(cmdline_t *ptr)
struct x86_dr_low_type x86_dr_low
void inf_child_maybe_unpush_target(struct target_ops *ops)
static void go32_files_info(struct target_ops *target)
CORE_ADDR(* get_addr)(int)
static int my_write_child(unsigned child_addr, const void *buf, unsigned len)
static int device_mode(int fd, int raw_p)
int i386_fpc_regnum_p(struct gdbarch *gdbarch, int regnum)
void printf_filtered(const char *format,...)
char * nl_langinfo(nl_item item)
void(* to_files_info)(struct target_ops *) TARGET_DEFAULT_IGNORE()
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
const char * normal_pid_to_str(ptid_t ptid)
static void go32_terminal_inferior(struct target_ops *self)
struct cmd_list_element * infolist
void(* set_addr)(int, CORE_ADDR)
static unsigned long get_pte(unsigned long pde, int n)
static void go32_pde(const char *arg, int from_tty)
static void fetch_register(struct regcache *regcache, int regno)
static int dos_codepage(void)
static enum target_xfer_status go32_xfer_partial(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
static int get_descriptor(unsigned long table_base, int idx, void *descr)
unsigned long(* get_status)(void)
int redir_cmdline_parse(const char *args, cmdline_t *ptr)
void(* to_resume)(struct target_ops *, ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
void puts_filtered(const char *string)
static cmdline_t child_cmd
ptid_t pid_to_ptid(int pid)
unsigned short windows_major
unsigned short limit __attribute__((packed))
static void go32_get_windows_version(void)
static void go32_sldt(const char *arg, int from_tty)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
static struct cmd_list_element * info_dos_cmdlist
struct thread_info * add_thread_silent(ptid_t ptid)
const char * gdb_signal_to_name(enum gdb_signal)
enum target_xfer_status(* to_xfer_partial)(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) TARGET_DEFAULT_RETURN(TARGET_XFER_E_IO)
void printf_unfiltered(const char *format,...)
void printfi_filtered(int spaces, const char *format,...)
static enum target_xfer_status go32_xfer_memory(gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
struct dtr_reg __attribute__
unsigned long(* get_control)(void)
int target_is_pushed(struct target_ops *t)
void redir_cmdline_delete(cmdline_t *ptr)
static void go32_kill_inferior(struct target_ops *ops)
PTR xrealloc(PTR ptr, size_t size)
static void go32_create_inferior(struct target_ops *ops, const char *exec_file, const std::string &allargs, char **env, int from_tty)
struct target_ops * inf_child_target(void)
static void go32_sgdt(const char *arg, int from_tty)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
static struct @72 excepn_map[]
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
void(* to_mourn_inferior)(struct target_ops *) TARGET_DEFAULT_FUNC(default_mourn_inferior)
static int prog_has_started
static void go32_sidt(const char *arg, int from_tty)
static unsigned long pdbr
int gdbarch_fp0_regnum(struct gdbarch *gdbarch)
static char child_cwd[FILENAME_MAX]
int xsnprintf(char *str, size_t size, const char *format,...)
CORE_ADDR parse_and_eval_address(const char *exp)
void clear_proceed_status(int step)
void(* to_kill)(struct target_ops *) TARGET_DEFAULT_NORETURN(noprocess())
int redir_to_child(cmdline_t *ptr)
static void store_register(const struct regcache *regcache, int regno)
char * safe_strerror(int)
static void save_npx(void)
void(* to_terminal_ours)(struct target_ops *) TARGET_DEFAULT_IGNORE()
int ptid_equal(const ptid_t &ptid1, const ptid_t &ptid2)
struct inferior * current_inferior(void)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
void(* to_terminal_inferior)(struct target_ops *) TARGET_DEFAULT_IGNORE()
unsigned long long ULONGEST
void x86_set_debug_register_length(int len)
static unsigned long get_pde(int n)
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
void x86_use_watchpoints(struct target_ops *t)
int tcsetpgrp(int fd, pid_t pgid)
void(* to_create_inferior)(struct target_ops *, const char *, const std::string &, char **, int)
static struct @70 regno_mapping[]
int(* to_thread_alive)(struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN(0)
static void go32_terminal_ours(struct target_ops *self)
static void go32_terminal_init(struct target_ops *self)
void(* to_attach)(struct target_ops *ops, const char *, int)
static void go32_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal siggnal)
static void go32_pte_for_address(const char *arg, int from_tty)
static unsigned long go32_get_dr6(void)
void x86_cleanup_dregs(void)
static int inf_mode_valid
static const char * go32_pid_to_str(struct target_ops *ops, ptid_t ptid)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
static void go32_mourn_inferior(struct target_ops *ops)
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_FUNC(default_target_wait)
static struct target_ops * go32_target(void)
void error(const char *fmt,...)
struct target_ops * beneath
static unsigned long get_cr3(void)
void inferior_appeared(struct inferior *inf, int pid)
void(* to_terminal_info)(struct target_ops *, const char *, int) TARGET_DEFAULT_FUNC(default_terminal_info)
static void go32_attach(struct target_ops *ops, const char *args, int from_tty)
LONGEST parse_and_eval_long(const char *exp)