From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stan Shebs To: guo@cup.hp.com Cc: gdb-patches@sourceware.cygnus.com Subject: Re: submission: gdb/testsuite/gdb.chill patch Date: Fri, 25 Jun 1999 12:20:00 -0000 Message-id: <199906251920.MAA26844@andros.cygnus.com> References: X-SW-Source: 1999-q2/msg00152.html Date: Fri, 25 Jun 1999 11:07:18 -0700 (PDT) From: Jimmy Guo This is the (trivial) patch to gdb/testsuite/gdb.chill. It contains file renames and corresponding changes (reflect file name changes): Thanks much! I added a ChangeLog entry and committed to the repository. Now on to the big hard one... Stan >From dj@delorie.com Sun Jun 27 10:48:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Patches to gdb/go32-nat.c] Date: Sun, 27 Jun 1999 10:48:00 -0000 Message-id: <199906271747.NAA32004@envy.delorie.com> X-SW-Source: 1999-q2/msg00153.html Content-length: 24615 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:46:05 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: gdb-patches@sourceware.cygnus.com cc: DJ Delorie Subject: Patches to gdb/go32-nat.c Content-Type: TEXT/PLAIN; charset=US-ASCII The following patches to go32-nat.c correct quite a few problems in the DJGPP version. 1999-06-26 Eli Zaretskii * go32-nat.c (redir_cmdline_parse, redir_cmdline_delete, redir_to_child, redir_to_debugger, redir_debug_init) [__DJGPP_MINOR__ < 3]: Dummy stubs for redirecting debuggee's standard handles. (print_387_status): Print "last FP instruction", not "last exception". Restore the upper 5 bits of the opcode that aren't stored in the FPU state. Print the FPU stack in its physical order, not relative to ST(0). Print "special", not "trap" for unnormals and infinities. Print all 10 bytes of each FP register, and print them with 19 significant digits. (regno_mapping): Make the mapping consistent with tm-go32.h. (sig_map): Add mappings for SIGQUIT, SIGFPE, SIGALRM. Map NMI to SIGBUS. (excep_map): New variable, maps GDB signals to DJGPP exceptions. (go32_attach): Signal an error: we cannot attach to other processes. (go32_resume): Record the signal with which the inferior should be resumed, mapped to the DJGPP exception number. (go32_wait): Pass the signal recorded in go32_resume to the debuggee. Save and restore debugger's and debuggee's current working directory. [__DJGPP_MINOR__ < 3]: Save and restore inferior's FPU state. (store_register): FPU regsiters have numbers less than 31. (go32_kill_inferior): Delete the parsed command-line storage. (go32_create_inferior): Initialize the parsed command-line storage. Parse the command line and create the redirections for inferior's standard handles. [__DJGPP_MINOR__ < 3]: Init the inferior's FPU state. (ignore2): Function deleted. (device_mode): New function, switches a character device between raw and cooked mode. (go32_terminal_init): Invalidate the raw/cooked mode information. (go32_terminal_info): Print whether the inferior's terminal is in raw or cooked mode. [__DJGPP_MINOR__ > 2]: Say if standard handles are redirected or closed by the inferior. (go32_terminal_inferior): Switch standard handles to the inferior's files/devices. Put the inferior's input device to raw/cooked mode, exactly like we found it last time. (go32_terminal_ours): Restore debugger's standard handles and put the terminal into cooked mode. Save the mode of inferior's input device. (init_go32_ops): Assign go32_ops.to_attach, go32_ops.to_terminal_info, go32_ops.to_terminal_ours_for_output. Initialize inferior's cwd and the command-line storage. *** cvs/gdb/go32-nat.c Mon Jun 7 22:17:28 1999 - --- ./gdb/go32-nat.c Sat Jun 26 19:27:58 1999 *************** Foundation, Inc., 59 Temple Place - Suit *** 32,40 **** - --- 32,46 ---- #include /* required for __DJGPP_MINOR__ */ #include #include + #include #include + #include + #include #include #include + #if __DJGPP_MINOR__ > 2 + #include + #endif #if __DJGPP_MINOR__ < 3 /* This code will be provided from DJGPP 2.03 on. Until then I code it *************** load_npx (void) *** 93,98 **** - --- 99,125 ---- { asm ("frstor %0" : "=m" (npx)); } + /* ------------------------------------------------------------------------- */ + /* Stubs for the missing redirection functions. */ + typedef struct { + char *command; + int redirected; + } cmdline_t; + + void redir_cmdline_delete (cmdline_t *ptr) {ptr->redirected = 0;} + int redir_cmdline_parse (const char *args, cmdline_t *ptr) + { + return -1; + } + int redir_to_child (cmdline_t *ptr) + { + return 1; + } + int redir_to_debugger (cmdline_t *ptr) + { + return 1; + } + int redir_debug_init (cmdline_t *ptr) { return 0; } #endif /* __DJGPP_MINOR < 3 */ extern void _initialize_go32_nat (void); *************** print_387_status (unsigned short status, *** 197,204 **** } print_387_control_word (ep->control & 0xffff); ! printf_unfiltered ("last exception: "); ! printf_unfiltered ("opcode %s; ", local_hex_string (ep->opcode)); printf_unfiltered ("pc %s:", local_hex_string (ep->code_seg)); printf_unfiltered ("%s; ", local_hex_string (ep->eip)); printf_unfiltered ("operand %s", local_hex_string (ep->operand_seg)); - --- 224,237 ---- } print_387_control_word (ep->control & 0xffff); ! /* Other platforms say "last exception", but that's not true: the ! FPU stores the last non-control instruction there. */ ! printf_unfiltered ("last FP instruction: "); ! /* The ORing with D800h restores the upper 5 bits of the opcode that ! are not stored by the FPU (since these bits are the same for all ! floating-point instructions). */ ! printf_unfiltered ("opcode %s; ", ! local_hex_string (ep->opcode ? (ep->opcode|0xd800) : 0)); printf_unfiltered ("pc %s:", local_hex_string (ep->code_seg)); printf_unfiltered ("%s; ", local_hex_string (ep->eip)); printf_unfiltered ("operand %s", local_hex_string (ep->operand_seg)); *************** print_387_status (unsigned short status, *** 206,240 **** top = (ep->status >> 11) & 7; ! printf_unfiltered ("regno tag msb lsb value\n"); ! for (fpreg = 0; fpreg < 8; fpreg++) { long double val; printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); switch ((ep->tag >> (fpreg * 2)) & 3) { case 0: ! printf_unfiltered ("valid "); break; case 1: ! printf_unfiltered ("zero "); break; case 2: ! printf_unfiltered ("trap "); break; case 3: ! printf_unfiltered ("empty "); break; } ! for (i = 0; i < 8; i++) ! printf_unfiltered ("%02x", ep->regs[fpreg][i]); ! REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM + fpreg, builtin_type_long_double, ! &ep->regs[fpreg], &val); ! printf_unfiltered (" %LG\n", val); } } - --- 239,282 ---- top = (ep->status >> 11) & 7; ! printf_unfiltered ("regno tag msb lsb value\n"); ! for (fpreg = 7; fpreg >= 0; fpreg--) { + /* FNSAVE saves the FP registers in their logical TOP-relative + order, beginning with ST(0). Since we need to print them in + their physical order, we have to remap them. */ + int regno = fpreg - top; long double val; + if (regno < 0) + regno += 8; + printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); switch ((ep->tag >> (fpreg * 2)) & 3) { case 0: ! printf_unfiltered ("valid "); break; case 1: ! printf_unfiltered ("zero "); break; case 2: ! /* All other versions of print_387_status use TRAP here, but I ! think this is misleading, since Intel manuals say SPECIAL. */ ! printf_unfiltered ("special "); break; case 3: ! printf_unfiltered ("empty "); break; } ! for (i = 9; i >= 0; i--) ! printf_unfiltered ("%02x", ep->regs[regno][i]); ! REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM+regno, builtin_type_long_double, ! &ep->regs[regno], &val); ! printf_unfiltered (" %.19LG\n", val); } } *************** i386_go32_float_info (void) *** 244,259 **** print_387_status (0, (struct env387 *) &npx); } ! #define r_ofs(x) ((int)(&(((TSS *)0)->x))) static struct { ! int tss_ofs; ! int size; } regno_mapping[] = { ! r_ofs (tss_eax), 4, r_ofs (tss_ecx), 4, r_ofs (tss_edx), 4, r_ofs (tss_ebx), 4, - --- 286,301 ---- print_387_status (0, (struct env387 *) &npx); } ! #define r_ofs(x) (offsetof(TSS,x)) static struct { ! size_t tss_ofs; ! size_t size; } regno_mapping[] = { ! r_ofs (tss_eax), 4, /* normal registers, from a_tss */ r_ofs (tss_ecx), 4, r_ofs (tss_edx), 4, r_ofs (tss_ebx), 4, *************** regno_mapping[] = *** 269,275 **** r_ofs (tss_es), 2, r_ofs (tss_fs), 2, r_ofs (tss_gs), 2, ! 0, 10, 1, 10, 2, 10, 3, 10, - --- 311,317 ---- r_ofs (tss_es), 2, r_ofs (tss_fs), 2, r_ofs (tss_gs), 2, ! 0, 10, /* 8 FP registers, from npx.reg[] */ 1, 10, 2, 10, 3, 10, *************** regno_mapping[] = *** 277,289 **** 5, 10, 6, 10, 7, 10, ! 0, 2, ! 4, 2, ! 8, 2, ! 12, 4, ! 16, 2, ! 20, 4, ! 24, 2 }; static struct - --- 319,333 ---- 5, 10, 6, 10, 7, 10, ! /* The order of the next 7 registers must be consistent ! with their numbering in config/i386/tm-go32.h, which see. */ ! 0, 2, /* control word, from npx */ ! 4, 2, /* status word, from npx */ ! 8, 2, /* tag word, from npx */ ! 16, 2, /* last FP exception CS from npx */ ! 24, 2, /* last FP exception operand selector from npx */ ! 12, 4, /* last FP exception EIP from npx */ ! 20, 4 /* last FP exception operand offset from npx */ }; static struct *************** sig_map[] = *** 295,301 **** { 0, TARGET_SIGNAL_FPE, 1, TARGET_SIGNAL_TRAP, ! 2, TARGET_SIGNAL_UNKNOWN, 3, TARGET_SIGNAL_TRAP, 4, TARGET_SIGNAL_FPE, 5, TARGET_SIGNAL_SEGV, - --- 339,348 ---- { 0, TARGET_SIGNAL_FPE, 1, TARGET_SIGNAL_TRAP, ! /* Exception 2 is triggered by the NMI. DJGPP handles it as SIGILL, ! but I think SIGBUS is better, since the NMI is usually activated ! as a result of a memory parity check failure. */ ! 2, TARGET_SIGNAL_BUS, 3, TARGET_SIGNAL_TRAP, 4, TARGET_SIGNAL_FPE, 5, TARGET_SIGNAL_SEGV, *************** sig_map[] = *** 306,325 **** 10, TARGET_SIGNAL_BUS, 11, TARGET_SIGNAL_SEGV, 12, TARGET_SIGNAL_SEGV, ! 13, TARGET_SIGNAL_ABRT, 14, TARGET_SIGNAL_SEGV, 16, TARGET_SIGNAL_FPE, 31, TARGET_SIGNAL_ILL, 0x75, TARGET_SIGNAL_FPE, 0x79, TARGET_SIGNAL_INT, ! 0x1b, TARGET_SIGNAL_INT, -1, -1 }; static void go32_open (char *name, int from_tty) { ! printf_unfiltered ("Use the `run' command to run go32 programs\n"); } static void - --- 353,392 ---- 10, TARGET_SIGNAL_BUS, 11, TARGET_SIGNAL_SEGV, 12, TARGET_SIGNAL_SEGV, ! 13, TARGET_SIGNAL_SEGV, 14, TARGET_SIGNAL_SEGV, 16, TARGET_SIGNAL_FPE, + 17, TARGET_SIGNAL_BUS, 31, TARGET_SIGNAL_ILL, + 0x1b, TARGET_SIGNAL_INT, 0x75, TARGET_SIGNAL_FPE, + 0x78, TARGET_SIGNAL_ALRM, 0x79, TARGET_SIGNAL_INT, ! 0x7a, TARGET_SIGNAL_QUIT, -1, -1 }; + static struct { + enum target_signal gdb_sig; + int djgpp_excepno; + } excepn_map[] = { + TARGET_SIGNAL_0, -1, + TARGET_SIGNAL_ILL, 6, /* Invalid Opcode */ + TARGET_SIGNAL_TRAP, 1, /* Debug */ + TARGET_SIGNAL_BUS, 17, /* Alignment Check */ + TARGET_SIGNAL_SEGV, 13, /* GPF */ + TARGET_SIGNAL_FPE, 0x75, /* this and the rest are fake exceptions */ + TARGET_SIGNAL_INT, 0x79, /* see dpmiexcp.c in djlsr*.zip for details */ + TARGET_SIGNAL_QUIT, 0x7a, + TARGET_SIGNAL_ALRM, 0x78, + TARGET_SIGNAL_PROF, 0x78, + 0, 0 + }; + static void go32_open (char *name, int from_tty) { ! printf_unfiltered ("Done. Use the \"run\" command to run the program.\n"); } static void *************** go32_close (int quitting) *** 330,336 **** static void go32_attach (char *args, int from_tty) { ! printf_unfiltered ("Use the `run' command to run go32 programs\n"); } static void - --- 397,405 ---- static void go32_attach (char *args, int from_tty) { ! error ("\ ! You cannot attach to a running program on this platform.\n\ ! Use the `run' command to run DJGPP programs."); } static void *************** go32_detach (char *args, int from_tty) *** 339,350 **** } static int resume_is_step; static void go32_resume (int pid, int step, enum target_signal siggnal) ! { ! resume_is_step = step; ! } static int go32_wait (int pid, struct target_waitstatus *status) - --- 408,431 ---- } static int resume_is_step; + static int resume_signal = -1; static void go32_resume (int pid, int step, enum target_signal siggnal) ! { ! int i; ! ! resume_is_step = step; ! ! for (i = 0, resume_signal = -1; excepn_map[i].gdb_sig != 0; i++) ! if (excepn_map[i].gdb_sig == siggnal) ! { ! resume_signal = excepn_map[i].djgpp_excepno; ! break; ! } ! } ! ! static char child_cwd[FILENAME_MAX]; static int go32_wait (int pid, struct target_waitstatus *status) *************** go32_wait (int pid, struct target_waitst *** 355,369 **** a_tss.tss_eflags |= 0x0100; else a_tss.tss_eflags &= 0xfeff; #if __DJGPP_MINOR__ < 3 ! save_npx (); #endif run_child (); #if __DJGPP_MINOR__ < 3 ! load_npx (); #endif if (a_tss.tss_irqn == 0x21) { status->kind = TARGET_WAITKIND_EXITED; - --- 436,471 ---- a_tss.tss_eflags |= 0x0100; else a_tss.tss_eflags &= 0xfeff; + if (resume_signal <= -1) + a_tss.tss_trap = 0; + else + { + /* FIXME: this doesn't seem to work for all signals. SIGSEGV + and SIGTRAP do work, but SIGFPE and SIGBUS don't. Why? */ + a_tss.tss_trap = 0xffff; /* run_child looks for this */ + a_tss.tss_irqn = resume_signal; + } + + /* The child might change working directory behind our back. The + GDB users won't like the side effects of that when they work with + relative file names, and GDB might be confused by its current + directory not being in sync with the truth. So we always make a + point of changing back to where GDB thinks is its cwd, when we + return control to the debugger, but restore child's cwd before we + run it. */ + chdir (child_cwd); #if __DJGPP_MINOR__ < 3 ! load_npx (); #endif run_child (); #if __DJGPP_MINOR__ < 3 ! save_npx (); #endif + getcwd (child_cwd, sizeof (child_cwd)); /* in case it has changed */ + chdir (current_directory); + if (a_tss.tss_irqn == 0x21) { status->kind = TARGET_WAITKIND_EXITED; *************** go32_wait (int pid, struct target_waitst *** 377,385 **** - --- 479,491 ---- { if (a_tss.tss_irqn == sig_map[i].go32_sig) { + #if __DJGPP_MINOR__ < 3 if ((status->value.sig = sig_map[i].gdb_sig) != TARGET_SIGNAL_TRAP) status->kind = TARGET_WAITKIND_SIGNALLED; + #else + status->value.sig = sig_map[i].gdb_sig; + #endif break; } } *************** go32_fetch_registers (int regno) *** 410,422 **** (char *) &npx.reg[regno_mapping[regno].tss_ofs]); else if (regno < 31) supply_register (regno, ! (char *) &npx.reg + regno_mapping[regno].tss_ofs); else ! { ! printf_unfiltered ("Invalid register in go32_fetch_register(%d)", ! regno); ! exit (1); ! } } } - --- 516,524 ---- (char *) &npx.reg[regno_mapping[regno].tss_ofs]); else if (regno < 31) supply_register (regno, ! (char *) &npx + regno_mapping[regno].tss_ofs); else ! fatal ("Invalid register no. %d in go32_fetch_register.", regno); } } *************** store_register (int regno) *** 430,442 **** rp = (char *) &a_tss + regno_mapping[regno].tss_ofs; else if (regno < 24) rp = (char *) &npx.reg[regno_mapping[regno].tss_ofs]; ! else if (regno > 31) rp = (char *) &npx + regno_mapping[regno].tss_ofs; else ! { ! printf_unfiltered ("Invalid register in store_register(%d)", regno); ! exit (1); ! } memcpy (rp, v, regno_mapping[regno].size); } - --- 532,541 ---- rp = (char *) &a_tss + regno_mapping[regno].tss_ofs; else if (regno < 24) rp = (char *) &npx.reg[regno_mapping[regno].tss_ofs]; ! else if (regno < 31) rp = (char *) &npx + regno_mapping[regno].tss_ofs; else ! fatal ("Invalid register no. %d in store_register.", regno); memcpy (rp, v, regno_mapping[regno].size); } *************** go32_xfer_memory (CORE_ADDR memaddr, cha *** 487,496 **** } } static void go32_files_info (struct target_ops *target) { ! printf_unfiltered ("You are running a DJGPP V2 program\n"); } static void - --- 586,597 ---- } } + static cmdline_t child_cmd; /* parsed child's command line kept here */ + static void go32_files_info (struct target_ops *target) { ! printf_unfiltered ("You are running a DJGPP V2 program.\n"); } static void *************** go32_stop (void) *** 505,510 **** - --- 606,614 ---- static void go32_kill_inferior (void) { + redir_cmdline_delete (&child_cmd); + resume_signal = -1; + resume_is_step = 0; unpush_target (&go32_ops); } *************** go32_create_inferior (char *exec_file, c *** 520,525 **** - --- 624,645 ---- go32_stop (); go32_kill_inferior (); } + resume_signal = -1; + resume_is_step = 0; + /* Init command line storage. */ + if (redir_debug_init (&child_cmd) == -1) + fatal ("Cannot allocate redirection storage: not enough memory.\n"); + + /* Parse the command line and create redirections. */ + if (strpbrk (args, "<>")) + { + if (redir_cmdline_parse (args, &child_cmd) == 0) + args = child_cmd.command; + else + error ("Syntax error in command line."); + } + else + child_cmd.command = strdup (args); cmdline = (char *) alloca (strlen (args) + 4); cmdline[0] = strlen (args); *************** go32_create_inferior (char *exec_file, c *** 537,542 **** - --- 657,665 ---- environ = env_save; edi_init (start_state); + #if __DJGPP_MINOR__ < 3 + save_npx (); + #endif inferior_pid = SOME_PID; push_target (&go32_ops); *************** ignore (void) *** 564,574 **** { } - - static void - - ignore2 (char *a, int b) - - { - - } - - /* Hardware watchpoint support. */ #define DR_STATUS 6 - --- 687,692 ---- *************** go32_insert_hw_breakpoint (CORE_ADDR add *** 818,856 **** return 0; } ! static int inf_flags_valid = 0; ! static int inf_in_flag; ! static int inf_out_flag; static void go32_terminal_init (void) { ! /* Save the filemodes for stdin/stout */ ! inf_in_flag = setmode(0, 0); ! setmode(0, inf_in_flag); ! inf_out_flag = setmode(1, 0); ! setmode(1, inf_out_flag); ! inf_flags_valid = 1; } static void go32_terminal_inferior (void) { ! /* set the filemodes for stdin/stdout of the inferior */ ! if (inf_flags_valid) ! { ! setmode(0, inf_in_flag); ! setmode(1, inf_out_flag); ! } } static void go32_terminal_ours (void) { ! /* Switch to text mode on stdin/stdout always on the gdb terminal and ! save the inferior modes to be restored later */ ! inf_in_flag = setmode(0, O_TEXT); ! inf_out_flag = setmode(1, O_TEXT); } static void - --- 936,1067 ---- return 0; } ! /* Put the device open on handle FD into either raw or cooked ! mode, return 1 if it was in raw mode, zero otherwise. */ ! ! static int ! device_mode (int fd, int raw_p) ! { ! int oldmode, newmode; ! __dpmi_regs regs; ! ! regs.x.ax = 0x4400; ! regs.x.bx = fd; ! __dpmi_int(0x21, ®s); ! if (regs.x.flags & 1) ! return -1; ! newmode = oldmode = regs.x.dx; ! ! if (raw_p) ! newmode |= 0x20; ! else ! newmode &= ~0x20; ! ! if (oldmode & 0x80) /* Only for character dev */ ! { ! regs.x.ax = 0x4401; ! regs.x.bx = fd; ! regs.x.dx = newmode & 0xff; /* Force upper byte zero, else it fails */ ! __dpmi_int(0x21, ®s); ! if (regs.x.flags & 1) ! return -1; ! } ! return (oldmode & 0x20) == 0x20; ! } ! ! ! static int inf_mode_valid = 0; ! static int inf_terminal_mode; ! ! /* This semaphore is needed because, amazingly enough, GDB calls ! target.to_terminal_ours more than once after the inferior stops. ! But we need the information from the first call only, since the ! second call will always see GDB's own cooked terminal. */ ! static int terminal_is_ours = 1; static void go32_terminal_init (void) { ! inf_mode_valid = 0; /* reinitialize, in case they are restarting child */ ! terminal_is_ours = 1; ! } ! ! static void ! go32_terminal_info (char *args, int from_tty) ! { ! printf_unfiltered ("Inferior's terminal is in %s mode.\n", ! !inf_mode_valid ! ? "default" : inf_terminal_mode ? "raw" : "cooked"); ! ! #if __DJGPP_MINOR__ > 2 ! if (child_cmd.redirection) ! { ! int i; ! ! for (i = 0; i < DBG_HANDLES; i++) ! { ! if (child_cmd.redirection[i]->file_name) ! printf_unfiltered ("\tFile handle %d is redirected to `%s'.\n", ! i, child_cmd.redirection[i]->file_name); ! else if (_get_dev_info(child_cmd.redirection[i]->inf_handle) == -1) ! printf_unfiltered ! ("\tFile handle %d appears to be closed by inferior.\n", i); ! /* Mask off the raw/cooked bit when comparing device info words. */ ! else if ((_get_dev_info(child_cmd.redirection[i]->inf_handle) & 0xdf) ! != (_get_dev_info(i) & 0xdf)) ! printf_unfiltered ! ("\tFile handle %d appears to be redirected by inferior.\n", i); ! } ! } ! #endif } static void go32_terminal_inferior (void) { ! /* Redirect standard handles as child wants them. */ ! errno = 0; ! if (redir_to_child (&child_cmd) == -1) ! { ! redir_to_debugger (&child_cmd); ! error ("Cannot redirect standard handles for program: %s.", ! strerror (errno)); ! } ! /* set the console device of the inferior to whatever mode ! (raw or cooked) we found it last time */ ! if (terminal_is_ours) ! { ! if (inf_mode_valid) ! device_mode (0, inf_terminal_mode); ! terminal_is_ours = 0; ! } } static void go32_terminal_ours (void) { ! /* Switch to cooked mode on the gdb terminal and save the inferior ! terminal mode to be restored when it is resumed */ ! if (!terminal_is_ours) ! { ! inf_terminal_mode = device_mode (0, 0); ! if (inf_terminal_mode != -1) ! inf_mode_valid = 1; ! else ! /* If device_mode returned -1, we don't know what happens with ! handle 0 anymore, so make the info invalid. */ ! inf_mode_valid = 0; ! terminal_is_ours = 1; ! ! /* Restore debugger's standard handles. */ ! errno = 0; ! if (redir_to_debugger (&child_cmd) == -1) ! { ! redir_to_child (&child_cmd); ! error ("Cannot redirect standard handles for debugger: %s.", ! strerror (errno)); ! } ! } } static void *************** init_go32_ops (void) *** 862,867 **** - --- 1073,1079 ---- "Program loaded by djgpp, when gdb is used as an external debugger"; go32_ops.to_open = go32_open; go32_ops.to_close = go32_close; + go32_ops.to_attach = go32_attach; go32_ops.to_detach = go32_detach; go32_ops.to_resume = go32_resume; go32_ops.to_wait = go32_wait; *************** init_go32_ops (void) *** 874,882 **** go32_ops.to_remove_breakpoint = memory_remove_breakpoint; go32_ops.to_terminal_init = go32_terminal_init; go32_ops.to_terminal_inferior = go32_terminal_inferior; ! go32_ops.to_terminal_ours_for_output = ignore; go32_ops.to_terminal_ours = go32_terminal_ours; ! go32_ops.to_terminal_info = ignore2; go32_ops.to_kill = go32_kill_inferior; go32_ops.to_create_inferior = go32_create_inferior; go32_ops.to_mourn_inferior = go32_mourn_inferior; - --- 1086,1094 ---- go32_ops.to_remove_breakpoint = memory_remove_breakpoint; go32_ops.to_terminal_init = go32_terminal_init; go32_ops.to_terminal_inferior = go32_terminal_inferior; ! go32_ops.to_terminal_ours_for_output = go32_terminal_ours; go32_ops.to_terminal_ours = go32_terminal_ours; ! go32_ops.to_terminal_info = go32_terminal_info; go32_ops.to_kill = go32_kill_inferior; go32_ops.to_create_inferior = go32_create_inferior; go32_ops.to_mourn_inferior = go32_mourn_inferior; *************** init_go32_ops (void) *** 889,894 **** - --- 1101,1113 ---- go32_ops.to_has_registers = 1; go32_ops.to_has_execution = 1; go32_ops.to_magic = OPS_MAGIC; + + /* Initialize child's cwd with the current one. */ + getcwd (child_cwd, sizeof (child_cwd)); + + /* Initialize child's command line storage. */ + if (redir_debug_init (&child_cmd) == -1) + fatal ("Cannot allocate redirection storage: not enough memory.\n"); } void ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:48:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: More signal-related patches for GDB] Date: Sun, 27 Jun 1999 10:48:00 -0000 Message-id: <199906271748.NAA32033@envy.delorie.com> X-SW-Source: 1999-q2/msg00156.html Content-length: 976 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 19:00:13 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: More signal-related patches for GDB Content-Type: TEXT/PLAIN; charset=US-ASCII 1999-06-26 Eli Zaretskii * maint.c (maintenance_dump_me) [__DJGPP__]: Make it so SIGQUIT produces traceback, the equivalent of a core dump. *** ./gdb/maint.c~0 Fri Jun 13 17:30:06 1997 - --- ./gdb/maint.c Thu May 20 21:33:42 1999 *************** maintenance_dump_me (args, from_tty) *** 99,105 **** - --- 99,110 ---- { if (query ("Should GDB dump core? ")) { + #ifdef __DJGPP__ + /* SIG_DFL for SIGQUIT is the same as SIG_IGN. */ + signal (SIGQUIT, __djgpp_traceback_exit); + #else signal (SIGQUIT, SIG_DFL); + #endif kill (getpid (), SIGQUIT); } } ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:48:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: DOSish filenames and CRLF source files] Date: Sun, 27 Jun 1999 10:48:00 -0000 Message-id: <199906271748.NAA32018@envy.delorie.com> X-SW-Source: 1999-q2/msg00154.html Content-length: 5348 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:51:28 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: gdb-patches@sourceware.cygnus.com cc: DJ Delorie Subject: DOSish filenames and CRLF source files Content-Type: TEXT/PLAIN; charset=US-ASCII The following patches solve some problems with DOS/Windows file names and with source files which have CRLF EOLs: 1999-06-26 Eli Zaretskii * source.c (mod_path) [_WIN32 || __DJGPP__]: Don't remove trailing slash from "d:/". Don't overstep the beginning of name. [_WIN32 || __MSDOS__]: Convert "d:" to "d:.", otherwise appending a slash changes its meaning. (openp): Use SLASH_P, not equality with SLASH_CHAR. (print_source_lines_base) [CRLF_SOURCE_FILES]: Skip \r only before a \n. (forward_search_command) [CRLF_SOURCE_FILES]: Remove \r at the end of all lines. (reverse_search_command) [CRLF_SOURCE_FILES]: Likewise. *** cvs/gdb/source.c Mon Jun 21 16:26:06 1999 - --- ./gdb/source.c Sat Jun 26 15:12:08 1999 *************** *** 338,352 **** } } ! #ifndef _WIN32 ! /* On win32 h:\ is different to h: */ ! if (SLASH_P (p[-1])) /* Sigh. "foo/" => "foo" */ --p; - - #endif *p = '\0'; ! while (p[-1] == '.') { if (p - name == 1) { - --- 338,354 ---- } } ! if (!(SLASH_P (*name) && p <= name + 1) /* "/" */ ! #if defined(_WIN32) || defined(__MSDOS__) ! /* On MS-DOS and MS-Windows, h:\ is different from h: */ ! && !(!SLASH_P (*name) && ROOTED_P (name) && p <= name + 3)/* d:/ */ ! #endif ! && SLASH_P (p[-1])) /* Sigh. "foo/" => "foo" */ --p; *p = '\0'; ! while (p > name && p[-1] == '.') { if (p - name == 1) { *************** *** 354,360 **** name = current_directory; goto append; } ! else if (SLASH_P (p[-2])) { if (p - name == 2) { - --- 356,362 ---- name = current_directory; goto append; } ! else if (p > name + 1 && SLASH_P (p[-2])) { if (p - name == 2) { *************** *** 376,381 **** - --- 378,387 ---- if (name[0] == '~') name = tilde_expand (name); + #if defined(_WIN32) || defined(__MSDOS__) + else if (ROOTED_P (name) && p == name + 2) /* "d:" => "d:." */ + name = concat (name, ".", NULL); + #endif else if (!ROOTED_P (name) && name[0] != '$') name = concat (current_directory, SLASH_STRING, name, NULL); else *************** *** 410,415 **** - --- 416,429 ---- p = *which_path; while (1) { + /* FIXME: strncmp loses in interesting ways on MS-DOS and + MS-Windows because of case-insensitivity and two different + but functionally identical slash characters. We need a + special filesystem-dependent file-name comparison function. + + Actually, even on Unix I would use realpath() or its work- + alike before comparing. Then all the code above which + removes excess slashes and dots could simply go away. */ if (!strncmp (p, name, len) && (p[len] == '\0' || p[len] == DIRNAME_SEPARATOR)) { *************** *** 598,605 **** /* Beware the // my son, the Emacs barfs, the botch that catch... */ *filename_opened = concat (current_directory, ! SLASH_CHAR ! == current_directory[strlen(current_directory)-1] ? "": SLASH_STRING, filename, NULL); } - --- 612,618 ---- /* Beware the // my son, the Emacs barfs, the botch that catch... */ *filename_opened = concat (current_directory, ! SLASH_P (current_directory[strlen(current_directory)-1]) ? "": SLASH_STRING, filename, NULL); } *************** *** 1058,1064 **** #ifdef CRLF_SOURCE_FILES else if (c == '\r') { ! /* Just skip \r characters. */ } #endif else - --- 1071,1083 ---- #ifdef CRLF_SOURCE_FILES else if (c == '\r') { ! /* Skip a \r character, but only before a \n. */ ! int c1 = fgetc (stream); ! ! if (c1 != '\n') ! printf_filtered ("^%c", c + 0100); ! if (c1 != EOF) ! ungetc (c1, stream); } #endif else *************** *** 1496,1501 **** - --- 1515,1530 ---- } } while (c != '\n' && (c = getc (stream)) >= 0); + #ifdef CRLF_SOURCE_FILES + /* Remove the \r, if any, at the end of the line, otherwise + regular expressions that end with $ or \n won't work. */ + if (p - buf > 1 && p[-2] == '\r') + { + p--; + p[-1] = '\n'; + } + #endif + /* we now have a source line in buf, null terminate and match */ *p = 0; if (re_exec (buf) > 0) *************** *** 1594,1599 **** - --- 1623,1638 ---- *p++ = c; } while (c != '\n' && (c = getc (stream)) >= 0); + #ifdef CRLF_SOURCE_FILES + /* Remove the \r, if any, at the end of the line, otherwise + regular expressions that end with $ or \n won't work. */ + if (p - buf > 1 && p[-2] == '\r') + { + p--; + p[-1] = '\n'; + } + #endif + /* We now have a source line in buf; null terminate and match. */ *p = 0; if (re_exec (buf) > 0) ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:48:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Directory- and filename-related problems in top.c] Date: Sun, 27 Jun 1999 10:48:00 -0000 Message-id: <199906271748.NAA32021@envy.delorie.com> X-SW-Source: 1999-q2/msg00155.html Content-length: 3430 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:56:07 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie Subject: Directory- and filename-related problems in top.c Content-Type: TEXT/PLAIN; charset=US-ASCII 1999-06-26 Eli Zaretskii * top.c (gdb_init) [__MSDOS__]: Arrange for GDB to return to the original directory before exiting. (cd_command) [_WIN32 || __MSDOS__]: Canonicalize the new directory name explicitly. Handle "d:/" names correctly. (init_history) [__MSDOS__]: Use _gdb_history as the default GDB history file name. *** ./gdb/top.c~1 Fri Jan 29 09:46:02 1999 - --- ./gdb/top.c Sat Jun 5 16:38:46 1999 *************** *** 656,661 **** - --- 656,667 ---- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); current_directory = gdb_dirbuf; + #ifdef __MSDOS__ + /* Make sure we return to the original directory upon exit, come + what may, since the OS doesn't do that for us. */ + make_final_cleanup ((make_cleanup_func) chdir, strsave (current_directory)); + #endif + init_cmd_lists (); /* This needs to be done first */ initialize_targets (); /* Setup target_terminal macros for utils.c */ initialize_utils (); /* Make errors and warnings possible */ *************** *** 3051,3063 **** if (chdir (dir) < 0) perror_with_name (dir); len = strlen (dir); ! dir = savestring (dir, len - (len > 1 && SLASH_P(dir[len-1]))); if (ROOTED_P(dir)) current_directory = dir; else { ! if (SLASH_P (current_directory[0]) && current_directory[1] == '\0') current_directory = concat (current_directory, dir, NULL); else current_directory = concat (current_directory, SLASH_STRING, dir, NULL); - --- 3057,3087 ---- if (chdir (dir) < 0) perror_with_name (dir); + #if defined(_WIN32) || defined(__MSDOS__) + /* There's too much mess with DOSish names like "d:", "d:.", + "d:./foo" etc. Instead of having lots of special #ifdef'ed code, + simply get the canonicalized name of the current directory. */ + dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); + #endif len = strlen (dir); ! if (SLASH_P (dir[len-1])) ! { ! /* Remove the trailing slash unless this is a root directory ! (including a drive letter on non-Unix systems). */ ! if (!(len == 1) /* "/" */ ! #if defined(_WIN32) || defined(__MSDOS__) ! && !(!SLASH_P (*dir) && ROOTED_P (dir) && len <= 3) /* "d:/" */ ! #endif ! ) ! len--; ! } ! ! dir = savestring (dir, len); if (ROOTED_P(dir)) current_directory = dir; else { ! if (SLASH_P (current_directory[strlen (current_directory) - 1])) current_directory = concat (current_directory, dir, NULL); else current_directory = concat (current_directory, SLASH_STRING, dir, NULL); *************** *** 3442,3448 **** - --- 3466,3477 ---- /* We include the current directory so that if the user changes directories the file written will be the same as the one that was read. */ + #ifdef __MSDOS__ + /* No leading dots in file names are allowed on MSDOS. */ + history_filename = concat (current_directory, "/_gdb_history", NULL); + #else history_filename = concat (current_directory, "/.gdb_history", NULL); + #endif } read_history (history_filename); } ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Terminal support in DJGPP port of GDB] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271748.NAA32036@envy.delorie.com> X-SW-Source: 1999-q2/msg00159.html Content-length: 1996 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 19:13:18 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: Terminal support in DJGPP port of GDB Content-Type: TEXT/PLAIN; charset=US-ASCII 1999-06-26 Eli Zaretskii * terminal.h [__GO32__]: Remove conditional; DJGPP now supports termios. *** cvs/gdb/terminal.h Fri Apr 16 04:34:06 1999 - --- ./gdb/terminal.h Fri May 21 22:44:08 1999 *************** Foundation, Inc., 59 Temple Place - Suit *** 29,36 **** nothing has already defined the one of the names, and do the right thing. */ - - /* nothing works with go32, and the headers aren't complete */ - - #if !defined (__GO32__) #if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) #if defined(HAVE_TERMIOS_H) #define HAVE_TERMIOS - --- 29,34 ---- *************** Foundation, Inc., 59 Temple Place - Suit *** 44,56 **** #endif /* ! defined (HAVE_TERMIO_H) */ #endif /* ! defined (HAVE_TERMIOS_H) */ #endif /* !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) */ - - #endif /* ! defined (__GO32__) */ #if defined(HAVE_TERMIOS) #include #endif ! #if !defined(__GO32__) && !defined(_WIN32) && !defined (HAVE_TERMIOS) /* Define a common set of macros -- BSD based -- and redefine whatever the system offers to make it look like that. FIXME: serial.h and - --- 42,53 ---- #endif /* ! defined (HAVE_TERMIO_H) */ #endif /* ! defined (HAVE_TERMIOS_H) */ #endif /* !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY) */ #if defined(HAVE_TERMIOS) #include #endif ! #if !defined(_WIN32) && !defined (HAVE_TERMIOS) /* Define a common set of macros -- BSD based -- and redefine whatever the system offers to make it look like that. FIXME: serial.h and ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: GDB: pexecute patches] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271749.NAA32053@envy.delorie.com> X-SW-Source: 1999-q2/msg00163.html Content-length: 1795 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 19:18:33 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: GDB: pexecute patches Content-Type: TEXT/PLAIN; charset=US-ASCII 1999-06-26 Eli Zaretskii * pexecute.c (pexecute) [__GO32__]: Use P_WAIT rather than a literal constant. [__DJGPP__]: Don't shift left the return code of spawn. *** ./libiberty/pexecute.c~0 Fri Jan 15 06:35:26 1999 - --- ./libiberty/pexecute.c Mon May 17 14:04:40 1999 *************** pexecute (program, argv, this_pname, tem *** 150,156 **** #ifdef __GO32__ /* ??? What are the possible return values from spawnv? */ ! rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv); #else char *scmd, *rf; FILE *argfile; - --- 150,156 ---- #ifdef __GO32__ /* ??? What are the possible return values from spawnv? */ ! rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv); #else char *scmd, *rf; FILE *argfile; *************** pexecute (program, argv, this_pname, tem *** 197,208 **** if (rc == -1) { *errmsg_fmt = install_error_msg; ! *errmsg_arg = program; return -1; } /* Tuck the status away for pwait, and return a "pid". */ last_status = rc << 8; return last_pid; } - --- 197,212 ---- if (rc == -1) { *errmsg_fmt = install_error_msg; ! *errmsg_arg = (char *)program; return -1; } /* Tuck the status away for pwait, and return a "pid". */ + #ifdef __DJGPP__ + last_status = rc; + #else last_status = rc << 8; + #endif return last_pid; } ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Shell escape in the DJGPP port of GDB] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271748.NAA32027@envy.delorie.com> X-SW-Source: 1999-q2/msg00166.html Content-length: 2233 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:58:13 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: Shell escape in the DJGPP port of GDB Content-Type: TEXT/PLAIN; charset=US-ASCII These patches make the shell command work correctly in the GDB port. 1999-06-26 Eli Zaretskii * command.c (CANT_FORK) [__MSDOS__]: Define. (shell_escape) [CANT_FORK]: If ARG is NULL, pass an empty string to `system'. [__DJGPP__]: Return to the original directory after the shell exits. *** ./gdb/command.c~0 Thu Dec 31 21:58:04 1998 - --- ./gdb/command.c Sat May 22 12:56:30 1999 *************** Foundation, Inc., 59 Temple Place - Suit *** 35,40 **** - --- 35,45 ---- #include "wait.h" + /* FIXME: this should be auto-configured! */ + #ifdef __MSDOS__ + # define CANT_FORK + #endif + /* Prototypes for local functions */ static void undef_cmd_error PARAMS ((char *, char *)); *************** shell_escape (arg, from_tty) *** 1441,1449 **** int from_tty; { #ifdef CANT_FORK ! /* FIXME: what about errors (I don't know how GO32 system() handles ! them)? */ ! system (arg); #else /* Can fork. */ int rc, status, pid; char *p, *user_shell; - --- 1446,1474 ---- int from_tty; { #ifdef CANT_FORK ! /* If ARG is NULL, they want an inferior shell, but `system' just ! reports if the shell is available when passed a NULL arg. */ ! int rc = system (arg ? arg : ""); ! ! if (!arg) ! arg = "inferior shell"; ! ! if (rc == -1) ! { ! fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg, ! safe_strerror (errno)); ! gdb_flush (gdb_stderr); ! } ! else if (rc) ! { ! fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc); ! gdb_flush (gdb_stderr); ! } ! #ifdef __DJGPP__ ! /* Make sure to return to the directory GDB thinks it is, in case the ! shell command we just ran changed it. */ ! chdir (current_directory); ! #endif #else /* Can fork. */ int rc, status, pid; char *p, *user_shell; ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: GDB: Stray bytes left in buffer by "info float"] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271749.NAA32047@envy.delorie.com> X-SW-Source: 1999-q2/msg00165.html Content-length: 1209 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 19:15:13 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: GDB: Stray bytes left in buffer by "info float" Content-Type: TEXT/PLAIN; charset=US-ASCII 1999-06-26 Eli Zaretskii * infcmd.c (do_registers_info): Zero out buffers before filling them with data from registers. *** ./gdb/infcmd.c~0 Wed Jan 6 03:06:20 1999 - --- ./gdb/infcmd.c Sat Jun 5 13:23:26 1999 *************** do_registers_info (regnum, fpregs) *** 1076,1081 **** - --- 1076,1086 ---- char raw_buffer[MAX_REGISTER_RAW_SIZE]; char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE]; + /* Zero out buffers, otherwise shorter registers may inherit stray + bits from longer ones. */ + memset (raw_buffer, 0, MAX_REGISTER_RAW_SIZE); + memset (virtual_buffer, 0, MAX_REGISTER_VIRTUAL_SIZE); + /* Decide between printing all regs, nonfloat regs, or specific reg. */ if (regnum == -1) { if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT && !fpregs) ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Problem with gnu-regex.c when wctype.h is available] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271748.NAA32010@envy.delorie.com> X-SW-Source: 1999-q2/msg00161.html Content-length: 1574 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:49:48 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: gdb-patches@sourceware.cygnus.com cc: DJ Delorie Subject: Problem with gnu-regex.c when wctype.h is available Content-Type: TEXT/PLAIN; charset=US-ASCII If wctype.h and wchar.h are available, but btowc is not (DJGPP is a case in point), gnu-regex.c causes link errors. Here's a patch: 1999-06-26 Eli Zaretskii * gnu-regex.c (CHAR_CLASS_MAX_LENGTH): Don't use wide characters unless HAVE_BTOWC is defined. *** cvs/gdb/gnu-regex.c Fri Apr 16 04:34:00 1999 - --- ./gdb/gnu-regex.c Mon May 17 17:21:56 1999 *************** *** 1700,1706 **** } \ } ! #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) /* The GNU C library provides support for user-defined character classes and the functions from ISO C amendement 1. */ # ifdef CHARCLASS_NAME_MAX - --- 1700,1710 ---- } \ } ! /* Use this only if they have btowc(), since wctype() is used below ! together with btowc(). btowc() is defined in the 1994 Amendment 1 ! to ISO C and may not be present on systems where we have wchar.h ! and wctype.h. */ ! #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_BTOWC) /* The GNU C library provides support for user-defined character classes and the functions from ISO C amendement 1. */ # ifdef CHARCLASS_NAME_MAX ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Hardware breakpoints in DJGPP port of GDB] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271747.NAA32007@envy.delorie.com> X-SW-Source: 1999-q2/msg00162.html Content-length: 1780 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:47:54 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: gdb-patches@sourceware.cygnus.com cc: DJ Delorie Subject: Hardware breakpoints in DJGPP port of GDB Content-Type: TEXT/PLAIN; charset=US-ASCII The following change resurrects hardware breakpoints in the DJGPP port of GDB, and avoid referencing a char array beyond its end: 1999-06-26 Eli Zaretskii * config/i386/xm-go32.h (ROOTED_P): Don't reference X[1] if X[0] is a null character. * config/i386/nm-go32.h (DECR_PC_AFTER_HW_BREAK): Define to 1. *** cvs/gdb/config/i386/xm-go32.h Mon Apr 26 21:26:22 1999 - --- gdb/config/i386/xm-go32.h Fri May 21 09:45:34 1999 *************** *** 25,31 **** #define SLASH_P(X) ((X)=='\\' || (X) == '/') ! #define ROOTED_P(X) ((SLASH_P((X)[0]))|| ((X)[1] ==':')) #define SLASH_CHAR '/' #define SLASH_STRING "/" - --- 25,31 ---- #define SLASH_P(X) ((X)=='\\' || (X) == '/') ! #define ROOTED_P(X) ((SLASH_P((X)[0])) || ((X)[0] && (X)[1] ==':')) #define SLASH_CHAR '/' #define SLASH_STRING "/" *** cvs/gdb/config/i386/nm-go32.h Tue Apr 27 04:26:18 1999 - --- gdb/config/i386/nm-go32.h Tue May 25 20:13:40 1999 *************** *** 48,54 **** #define target_remove_hw_breakpoint(addr, shadow) \ go32_remove_hw_breakpoint(addr, shadow) ! #define DECR_PC_AFTER_HW_BREAK 0 #undef FLOAT_INFO #define FLOAT_INFO { i386_go32_float_info (); } - --- 48,54 ---- #define target_remove_hw_breakpoint(addr, shadow) \ go32_remove_hw_breakpoint(addr, shadow) ! #define DECR_PC_AFTER_HW_BREAK 1 #undef FLOAT_INFO #define FLOAT_INFO { i386_go32_float_info (); } ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Termios support in the DJGPP port of GDB] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271748.NAA32030@envy.delorie.com> X-SW-Source: 1999-q2/msg00158.html Content-length: 902 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:59:32 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: Termios support in the DJGPP port of GDB Content-Type: TEXT/PLAIN; charset=US-ASCII Since we now use termios in GDB, these two functions need to be ifdef'ed away: 1999-06-26 Eli Zaretskii * inflow.c (tcgetpgrp, tcsetpgrp) [__DJGPP__]: Define away. *** ./gdb/inflow.c~1 Thu Dec 10 21:25:42 1998 - --- ./gdb/inflow.c Fri May 21 23:32:20 1999 *************** Foundation, Inc., 59 Temple Place - Suit *** 36,41 **** - --- 36,45 ---- #ifdef HAVE_TERMIOS #define PROCESS_GROUP_TYPE pid_t + #ifdef __DJGPP__ + #define tcgetpgrp(x) 42 + #define tcsetpgrp(f,x) 0 + #endif #endif #ifdef HAVE_TERMIO ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: GDB: suffix at end of numbers] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271749.NAA32050@envy.delorie.com> X-SW-Source: 1999-q2/msg00160.html Content-length: 6387 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 19:17:52 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: GDB: suffix at end of numbers Content-Type: TEXT/PLAIN; charset=US-ASCII Numbers like 1.0000L didn't work. Now they do: 1999-06-26 Eli Zaretskii * c-exp.y (parse_number): Don't let sscanf bail out prematurely when the number has a suffix. * jv-exp.y (parse_number): Likewise. *** ./gdb/c-exp.y~0 Wed Jan 6 16:52:16 1999 - --- ./gdb/c-exp.y Wed Jun 16 21:36:30 1999 *************** parse_number (p, len, parsed_float, puti *** 947,976 **** if (parsed_float) { /* It's a float since it contains a point or an exponent. */ ! char c; int num = 0; /* number of tokens scanned by scanf */ char saved_char = p[len]; p[len] = 0; /* null-terminate the token */ if (sizeof (putithere->typed_val_float.dval) <= sizeof (float)) ! num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c); else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double)) ! num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c); else { #ifdef SCANF_HAS_LONG_DOUBLE ! num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c); #else /* Scan it into a double, then assign it to the long double. This at least wins with values representable in the range of doubles. */ double temp; ! num = sscanf (p, "%lg%c", &temp,&c); putithere->typed_val_float.dval = temp; #endif } p[len] = saved_char; /* restore the input stream */ ! if (num != 1) /* check scanf found ONLY a float ... */ return ERROR; /* See if it has `f' or `l' suffix (float or long double). */ - --- 947,977 ---- if (parsed_float) { /* It's a float since it contains a point or an exponent. */ ! char c = 0, c2; int num = 0; /* number of tokens scanned by scanf */ char saved_char = p[len]; p[len] = 0; /* null-terminate the token */ if (sizeof (putithere->typed_val_float.dval) <= sizeof (float)) ! num = sscanf (p, "%g%c%c", (float *) &putithere->typed_val_float.dval,&c,&c2); else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double)) ! num = sscanf (p, "%lg%c%c", (double *) &putithere->typed_val_float.dval,&c,&c2); else { #ifdef SCANF_HAS_LONG_DOUBLE ! num = sscanf (p, "%Lg%c%c", &putithere->typed_val_float.dval,&c,&c2); #else /* Scan it into a double, then assign it to the long double. This at least wins with values representable in the range of doubles. */ double temp; ! num = sscanf (p, "%lg%c%c", &temp,&c,&c2); putithere->typed_val_float.dval = temp; #endif } p[len] = saved_char; /* restore the input stream */ ! if (num > 2 /* check scanf found ONLY a float ... */ ! || (num == 2 && strchr ("lLfF.", c) == NULL)) return ERROR; /* See if it has `f' or `l' suffix (float or long double). */ *** ./gdb/jv-exp.y~0 Thu Mar 4 20:56:38 1999 - --- ./gdb/jv-exp.y Wed Jun 16 21:41:04 1999 *************** parse_number (p, len, parsed_float, puti *** 697,734 **** if (parsed_float) { /* It's a float since it contains a point or an exponent. */ ! char c; int num = 0; /* number of tokens scanned by scanf */ char saved_char = p[len]; p[len] = 0; /* null-terminate the token */ if (sizeof (putithere->typed_val_float.dval) <= sizeof (float)) ! num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval, &c); else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double)) ! num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval, &c); else { #ifdef SCANF_HAS_LONG_DOUBLE ! num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval, &c); #else /* Scan it into a double, then assign it to the long double. This at least wins with values representable in the range of doubles. */ double temp; ! num = sscanf (p, "%lg%c", &temp, &c); putithere->typed_val_float.dval = temp; #endif } p[len] = saved_char; /* restore the input stream */ ! if (num != 1) /* check scanf found ONLY a float ... */ return ERROR; /* See if it has `f' or `d' suffix (float or double). */ c = tolower (p[len - 1]); ! if (c == 'f' || c == 'F') putithere->typed_val_float.type = builtin_type_float; ! else if (isdigit (c) || c == '.' || c == 'd' || c == 'D') putithere->typed_val_float.type = builtin_type_double; else return ERROR; - --- 697,735 ---- if (parsed_float) { /* It's a float since it contains a point or an exponent. */ ! char c = 0, c2; int num = 0; /* number of tokens scanned by scanf */ char saved_char = p[len]; p[len] = 0; /* null-terminate the token */ if (sizeof (putithere->typed_val_float.dval) <= sizeof (float)) ! num = sscanf (p, "%g%c%c", (float *) &putithere->typed_val_float.dval, &c, &c2); else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double)) ! num = sscanf (p, "%lg%c%c", (double *) &putithere->typed_val_float.dval, &c, &c2); else { #ifdef SCANF_HAS_LONG_DOUBLE ! num = sscanf (p, "%Lg%c%c", &putithere->typed_val_float.dval,&c,&c2); #else /* Scan it into a double, then assign it to the long double. This at least wins with values representable in the range of doubles. */ double temp; ! num = sscanf (p, "%lg%c%c", &temp, &c, &c2); putithere->typed_val_float.dval = temp; #endif } p[len] = saved_char; /* restore the input stream */ ! if (num > 2 /* check scanf found ONLY a float ... */ ! || (num == 2 && strchr ("fFdD.", c) == NULL)) return ERROR; /* See if it has `f' or `d' suffix (float or double). */ c = tolower (p[len - 1]); ! if (c == 'f') putithere->typed_val_float.type = builtin_type_float; ! else if (isdigit (c) || c == '.' || c == 'd') putithere->typed_val_float.type = builtin_type_double; else return ERROR; ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Signals support in DJGPP port of GDB] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271748.NAA32024@envy.delorie.com> X-SW-Source: 1999-q2/msg00164.html Content-length: 2805 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:57:10 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie Subject: Signals support in DJGPP port of GDB Content-Type: TEXT/PLAIN; charset=US-ASCII These changes fix some signal-related problems: 1999-06-26 Eli Zaretskii * utils.c (endif) [__DJGPP__]: Simulate a core dump with SIGABRT. (quit) [__MSDOS__]: Don't mention SIGINT, since it's not gonna happen. (notice_quit): No need to define this function for the DJGPP port. *** ./gdb/utils.c~0 Thu Feb 11 00:24:40 1999 - --- ./gdb/utils.c Sat May 22 08:47:34 1999 *************** fatal_dump_core (va_alist) *** 512,519 **** - --- 512,525 ---- fprintf_unfiltered (gdb_stderr, "\n"); va_end (args); + #ifdef __DJGPP__ + /* SIGQUIT by default is ignored, so use SIGABRT instead. */ + signal (SIGABRT, SIG_DFL); + kill (getpid (), SIGABRT); + #else signal (SIGQUIT, SIG_DFL); kill (getpid (), SIGQUIT); + #endif /* We should never get here, but just in case... */ exit (1); } *************** quit () *** 637,642 **** - --- 643,653 ---- if (quit_pre_print) fprintf_unfiltered (gdb_stderr, quit_pre_print); + #ifdef __MSDOS__ + /* No steenking SIGINT will ever be coming our way when the + program is resumed. Don't lie. */ + fprintf_unfiltered (gdb_stderr, "Quit\n"); + #else if (job_control /* If there is no terminal switching for this target, then we can't possibly get screwed by the lack of job control. */ *************** quit () *** 645,680 **** else fprintf_unfiltered (gdb_stderr, "Quit (expect signal SIGINT when the program is resumed)\n"); return_to_top_level (RETURN_QUIT); } ! ! #if defined(__GO32__) ! ! /* In the absence of signals, poll keyboard for a quit. ! Called from #define QUIT pollquit() in xm-go32.h. */ ! ! void ! notice_quit() ! { ! if (kbhit ()) ! switch (getkey ()) ! { ! case 1: ! quit_flag = 1; ! break; ! case 2: ! immediate_quit = 2; ! break; ! default: ! /* We just ignore it */ ! /* FIXME!! Don't think this actually works! */ ! fprintf_unfiltered (gdb_stderr, "CTRL-A to quit, CTRL-B to quit harder\n"); ! break; ! } ! } ! ! #elif defined(_MSC_VER) /* should test for wingdb instead? */ /* * Windows translates all keyboard and mouse events - --- 656,666 ---- else fprintf_unfiltered (gdb_stderr, "Quit (expect signal SIGINT when the program is resumed)\n"); + #endif return_to_top_level (RETURN_QUIT); } ! #if defined(_MSC_VER) /* should test for wingdb instead? */ /* * Windows translates all keyboard and mouse events ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:49:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: Empty header printed by "handle" command] Date: Sun, 27 Jun 1999 10:49:00 -0000 Message-id: <199906271748.NAA32039@envy.delorie.com> X-SW-Source: 1999-q2/msg00157.html Content-length: 1238 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 19:14:25 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: Empty header printed by "handle" command Content-Type: TEXT/PLAIN; charset=US-ASCII 1999-06-26 Eli Zaretskii * infrun.c (handle_command): Don't print header if no signal had its handling changed. *** ./gdb/infrun.c~1 Mon Mar 1 04:51:52 1999 - --- ./gdb/infrun.c Sat May 22 09:06:26 1999 *************** Are you sure you want to change it? ", *** 3328,3339 **** if (from_tty) { /* Show the results. */ - - sig_print_header (); for (signum = 0; signum < nsigs; signum++) { if (sigs[signum]) { sig_print_info (signum); } } - --- 3328,3345 ---- if (from_tty) { + int header_printed = 0; + /* Show the results. */ for (signum = 0; signum < nsigs; signum++) { if (sigs[signum]) { + if (!header_printed) + { + sig_print_header (); + header_printed = 1; + } sig_print_info (signum); } } ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:50:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: GDB: DJGPP-related problems in readline] Date: Sun, 27 Jun 1999 10:50:00 -0000 Message-id: <199906271749.NAA32059@envy.delorie.com> X-SW-Source: 1999-q2/msg00167.html Content-length: 20850 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 19:20:06 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: GDB: DJGPP-related problems in readline Content-Type: TEXT/PLAIN; charset=US-ASCII Note-from-DJ: This may be spam 1999-06-26 Eli Zaretskii * complete.c (username_completion_function) [__WIN32__]: Don't return NULL under DJGPP. (filename_completion_function) [__WIN32__ || __MSDOS__]: Handle drive-relative file names like "d:foo/bar". * bind.c (O_BINARY): If not defined, define to zero. (_rl_read_file): Open file in binary mode. Strip \r characters before every \n, and update the buffer size. (rl_read_init_file) [__MSDOS__]: Try ~/_inputrc if ~/.inputrc failed. * rltty.c [__GO32__]: Don't disable signals, don't include . (prepare_terminal_settings) [__GO32__]: No need to ifdef away, termios is supported now. (rl_prep_terminal): Ditto. (rl_deprep_terminal): Ditto. * input.c [__GO32__]: Don't include . (rl_gather_tyi) [__GO32__]: Remove ifdef'ed code; DJGPP now supports `select'. (rl_getc) [__GO32__]: Remove ifdef'ed code; DJGPP supports termios, single-character read's, and signals. * readline.c [__GO32__]: Don't disable signal handling. (rl_refresh_line) [__GO32__]: Remove old buggy code. * terminal.c (_rl_get_screen_size) [__DJGPP__]: Call ScreenCols and ScreenRows to get the screen size. (_rl_init_terminal_io) [__GO32__]: Call _rl_get_screen_size to set the screen size. (ding) [__DJGPP__]: Support visible bell. * signals.c [__DJGPP__]: Don't disable signal handling. Include . * histfile.c (read_history_range) [__MSDOS__]: Allow the default history file to begin with an underscore. Don't fail if the number of characters read is smaller than the file's size, due to stripped \r characters. (history_truncate_file) [__MSDOS__]: Allow the default history file to begin with an underscore. Use the actual number of chars read as the number of characters to write back. (history_do_write) [__MSDOS__]: Allow the default history file to begin with an underscore. * display.c (_rl_move_vert) [__GO32__]: fflush the output, to make sure the cursor position is updated. (_rl_clear_screen) [__GO32__]: Clear the text-mode screen. (insert_some_chars, delete_chars) [__GO32__]: Make these two functions a no-op: they are not called in the DJGPP version, and the code will crash if it runs. *** cvs/readline/complete.c Fri Apr 16 04:34:52 1999 - --- ./readline/complete.c Wed Jun 2 22:53:00 1999 *************** username_completion_function (text, stat *** 1361,1369 **** int state; char *text; { ! #if defined (__GO32__) || defined (__WIN32__) return (char *)NULL; ! #else /* !__GO32__ */ static char *username = (char *)NULL; static struct passwd *entry; static int namelen, first_char, first_char_loc; - --- 1361,1369 ---- int state; char *text; { ! #if defined (__WIN32__) return (char *)NULL; ! #else /* !__WIN32__ */ static char *username = (char *)NULL; static struct passwd *entry; static int namelen, first_char, first_char_loc; *************** username_completion_function (text, stat *** 1406,1412 **** return (value); } ! #endif /* !__GO32__ */ } /* Okay, now we write the entry_function for filename completion. In the - --- 1406,1412 ---- return (value); } ! #endif /* !__WIN32__ */ } /* Okay, now we write the entry_function for filename completion. In the *************** filename_completion_function (text, stat *** 1453,1458 **** - --- 1453,1466 ---- strcpy (filename, ++temp); *temp = '\0'; } + #if defined (__WIN32__) || defined (__MSDOS__) + /* Handle the drive-relative names "d:foo/bar". */ + else if (dirname[1] == ':') + { + strcpy (filename, dirname + 2); + dirname[2] = '\0'; + } + #endif else { dirname[0] = '.'; *** cvs/readline/bind.c Fri Apr 16 04:34:52 1999 - --- ./readline/bind.c Thu Jun 3 18:58:04 1999 *************** extern int errno; *** 62,67 **** - --- 62,71 ---- extern char *strchr (), *strrchr (); #endif /* !strchr && !__STDC__ */ + #ifndef O_BINARY + # define O_BINARY 0 + #endif + extern int _rl_horizontal_scroll_mode; extern int _rl_mark_modified_lines; extern int _rl_bell_preference; *************** _rl_read_file (filename, sizep) *** 642,648 **** char *buffer; int i, file; ! if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY, 0666)) < 0) return ((char *)NULL); file_size = (size_t)finfo.st_size; - --- 646,652 ---- char *buffer; int i, file; ! if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY|O_BINARY, 0666)) < 0) return ((char *)NULL); file_size = (size_t)finfo.st_size; *************** _rl_read_file (filename, sizep) *** 670,675 **** - --- 674,703 ---- } buffer[file_size] = '\0'; + + #if O_BINARY + { + /* Systems which distinguish between text and binary files need + to strip the CR characters before each Newline, otherwise the + parsing functions won't work. */ + char *s, *d; + size_t removed = 0; + + for (s = buffer, d = buffer; s < buffer + file_size; s++) + { + if (removed) + *d = *s; + if (*s != '\r' || s[1] != '\n') + d++; + else + removed++; + } + + file_size -= removed; + buffer[file_size] = '\0'; + } + #endif + if (sizep) *sizep = file_size; return (buffer); *************** rl_re_read_init_file (count, ignore) *** 691,696 **** - --- 719,725 ---- 1. the filename used for the previous call 2. the value of the shell variable `INPUTRC' 3. ~/.inputrc + 4. (for __MSDOS__ only) ~/_inputrc If the file existed and could be opened and read, 0 is returned, otherwise errno is returned. */ int *************** rl_read_init_file (filename) *** 710,715 **** - --- 739,758 ---- if (*filename == 0) filename = DEFAULT_INPUTRC; + #ifdef __MSDOS__ + { + /* DOS doesn't allow leading dots in file names. If the original + name fails (it could work if we are on Windows), fall back to + ~/_inputrc. */ + int retval = _rl_read_init_file (filename, 0); + + if (retval == 0) + return retval; + else if (strcmp (filename, "~/.inputrc") == 0) + filename = "~/_inputrc"; + } + #endif + return (_rl_read_init_file (filename, 0)); } *** cvs/readline/rltty.c Fri Apr 16 04:34:52 1999 - --- ./readline/rltty.c Thu May 20 19:20:02 1999 *************** extern int _rl_enable_keypad, _rl_enable *** 55,65 **** extern void _rl_control_keypad (); - - #if defined (__GO32__) - - # include - - # undef HANDLE_SIGNALS - - #endif /* __GO32__ */ - - /* Indirect functions to allow apps control over terminal management. */ extern void rl_prep_terminal (), rl_deprep_terminal (); - --- 55,60 ---- *************** prepare_terminal_settings (meta_flag, ot *** 260,266 **** int meta_flag; TIOTYPE otio, *tiop; { - - #if !defined (__GO32__) readline_echoing_p = (otio.sgttyb.sg_flags & ECHO); /* Copy the original settings to the structure we're going to use for - --- 255,260 ---- *************** prepare_terminal_settings (meta_flag, ot *** 326,332 **** tiop->ltchars.t_dsuspc = -1; /* C-y */ tiop->ltchars.t_lnextc = -1; /* C-v */ #endif /* TIOCGLTC */ - - #endif /* !__GO32__ */ } #else /* !defined (NEW_TTY_DRIVER) */ - --- 320,325 ---- *************** void *** 521,527 **** rl_prep_terminal (meta_flag) int meta_flag; { - - #if !defined (__GO32__) int tty; TIOTYPE tio; - --- 514,519 ---- *************** rl_prep_terminal (meta_flag) *** 556,569 **** terminal_prepped = 1; release_sigint (); - - #endif /* !__GO32__ */ } /* Restore the terminal's normal settings and modes. */ void rl_deprep_terminal () { - - #if !defined (__GO32__) int tty; if (!terminal_prepped) - --- 548,559 ---- *************** rl_deprep_terminal () *** 588,594 **** terminal_prepped = 0; release_sigint (); - - #endif /* !__GO32__ */ } /* **************************************************************** */ - --- 578,583 ---- *** cvs/readline/input.c Fri Apr 16 04:34:52 1999 - --- ./readline/input.c Wed May 19 22:26:44 1999 *************** extern Keymap _rl_keymap; *** 96,105 **** extern int _rl_convert_meta_chars_to_ascii; - - #if defined (__GO32__) - - # include - - #endif /* __GO32__ */ - - /* Non-null means it is a pointer to a function to run while waiting for character input. */ Function *rl_event_hook = (Function *)NULL; - --- 96,101 ---- *************** rl_unget_char (key) *** 201,217 **** static void rl_gather_tyi () { - - #if defined (__GO32__) - - char input; - - - - if (isatty (0) && kbhit () && ibuffer_space ()) - - { - - int i; - - i = (*rl_getc_function) (rl_instream); - - rl_stuff_char (i); - - } - - #else /* !__GO32__ */ - - int tty; register int tem, result; int chars_avail; - --- 197,202 ---- *************** rl_gather_tyi () *** 280,286 **** if (chars_avail) rl_stuff_char (input); } - - #endif /* !__GO32__ */ } /* Is there input available to be read on the readline input file - --- 265,270 ---- *************** rl_getc (stream) *** 392,402 **** int result, flags; unsigned char c; - - #if defined (__GO32__) - - if (isatty (0)) - - return (getkey () & 0x7F); - - #endif /* __GO32__ */ - - while (1) { result = read (fileno (stream), &c, sizeof (unsigned char)); - --- 376,381 ---- *************** rl_getc (stream) *** 438,449 **** } #endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */ - - #if !defined (__GO32__) /* If the error that we received was SIGINT, then try again, this is simply an interrupted system call to read (). Otherwise, some error ocurred, also signifying EOF. */ if (errno != EINTR) return (EOF); - - #endif /* !__GO32__ */ } } - --- 417,426 ---- *** cvs/readline/readline.c Fri Apr 16 04:34:52 1999 - --- ./readline/readline.c Thu May 20 18:09:24 1999 *************** static void readline_default_bindings () *** 174,180 **** #if defined (__GO32__) # include # include - - # undef HANDLE_SIGNALS #endif /* __GO32__ */ extern char *xmalloc (), *xrealloc (); - --- 174,179 ---- *************** rl_refresh_line () *** 1249,1267 **** _rl_move_vert (curr_line); _rl_move_cursor_relative (0, the_line); /* XXX is this right */ - - - - #if defined (__GO32__) - - { - - int row, col, width, row_start; - - - - ScreenGetCursor (&row, &col); - - width = ScreenCols (); - - row_start = ScreenPrimary + (row * width); - - memset (row_start + col, 0, (width - col) * 2); - - } - - #else /* !__GO32__ */ _rl_clear_to_eol (0); /* arg of 0 means to not use spaces */ - - #endif /* !__GO32__ */ rl_forced_update_display (); rl_display_fixed = 1; - --- 1248,1254 ---- *** cvs/readline/terminal.c Mon Apr 26 21:30:28 1999 - --- ./readline/terminal.c Sat May 22 17:12:48 1999 *************** _rl_get_screen_size (tty, ignore_env) *** 186,192 **** if (ignore_env == 0 && (ss = get_env_value ("COLUMNS"))) screenwidth = atoi (ss); ! #if !defined(__DJGPP__) if (screenwidth <= 0 && term_string_buffer) screenwidth = tgetnum ("co"); #endif - --- 186,195 ---- if (ignore_env == 0 && (ss = get_env_value ("COLUMNS"))) screenwidth = atoi (ss); ! #if defined(__DJGPP__) ! if (screenwidth <= 0) ! screenwidth = ScreenCols (); ! #else if (screenwidth <= 0 && term_string_buffer) screenwidth = tgetnum ("co"); #endif *************** _rl_get_screen_size (tty, ignore_env) *** 199,205 **** if (ignore_env == 0 && (ss = get_env_value ("LINES"))) screenheight = atoi (ss); ! #if !defined(__DJGPP__) if (screenheight <= 0 && term_string_buffer) screenheight = tgetnum ("li"); #endif - --- 202,211 ---- if (ignore_env == 0 && (ss = get_env_value ("LINES"))) screenheight = atoi (ss); ! #if defined(__DJGPP__) ! if (screenheight <= 0) ! screenheight = ScreenRows (); ! #else if (screenheight <= 0 && term_string_buffer) screenheight = tgetnum ("li"); #endif *************** _rl_init_terminal_io (terminal_name) *** 295,303 **** char *terminal_name; { #if defined (__GO32__) ! screenwidth = ScreenCols (); ! screenheight = ScreenRows (); ! screenchars = screenwidth * screenheight; term_cr = "\r"; term_im = term_ei = term_ic = term_IC = (char *)NULL; term_up = term_dc = term_DC = visible_bell = (char *)NULL; - --- 301,309 ---- char *terminal_name; { #if defined (__GO32__) ! screenwidth = screenheight = 0; ! _rl_get_screen_size (rl_instream ? fileno (rl_instream) : 0, 0); ! term_cr = "\r"; term_im = term_ei = term_ic = term_IC = (char *)NULL; term_up = term_dc = term_DC = visible_bell = (char *)NULL; *************** ding () *** 500,527 **** { if (readline_echoing_p) { - - #if !defined (__GO32__) switch (_rl_bell_preference) { case NO_BELL: default: break; case VISIBLE_BELL: if (visible_bell) { tputs (visible_bell, 1, _rl_output_character_function); break; } /* FALLTHROUGH */ case AUDIBLE_BELL: fprintf (stderr, "\007"); fflush (stderr); break; } - - #else /* __GO32__ */ - - fprintf (stderr, "\007"); - - fflush (stderr); - - #endif /* __GO32__ */ return (0); } return (-1); - --- 506,533 ---- { if (readline_echoing_p) { switch (_rl_bell_preference) { case NO_BELL: default: break; case VISIBLE_BELL: + #ifdef __DJGPP__ + ScreenVisualBell (); + break; + #else if (visible_bell) { tputs (visible_bell, 1, _rl_output_character_function); break; } /* FALLTHROUGH */ + #endif case AUDIBLE_BELL: fprintf (stderr, "\007"); fflush (stderr); break; } return (0); } return (-1); *** cvs/readline/signals.c Fri Apr 16 04:34:54 1999 - --- ./readline/signals.c Thu May 20 19:20:44 1999 *************** *** 40,48 **** # include #endif /* GWINSZ_IN_SYS_IOCTL */ ! #if defined (__GO32__) ! # undef HANDLE_SIGNALS ! #endif /* __GO32__ */ #if defined (HANDLE_SIGNALS) /* Some standard library routines. */ - --- 40,48 ---- # include #endif /* GWINSZ_IN_SYS_IOCTL */ ! #ifdef __DJGPP__ ! # include ! #endif #if defined (HANDLE_SIGNALS) /* Some standard library routines. */ *** cvs/readline/histfile.c Fri Apr 16 04:34:52 1999 - --- ./readline/histfile.c Sat Jun 5 16:11:48 1999 *************** read_history_range (filename, from, to) *** 140,145 **** - --- 140,154 ---- input = history_filename (filename); file = open (input, O_RDONLY|O_BINARY, 0666); + #ifdef __MSDOS__ + /* MSDOS doesn't allow leading dots in file names. Try again + with the dot replaced by an underscore. */ + if (file < 0 && !filename) + { + input[strlen (input) - 8] = '_'; + file = open (input, O_RDONLY|O_BINARY, 0666); + } + #endif if ((file < 0) || (fstat (file, &finfo) == -1)) goto error_and_exit; *************** read_history_range (filename, from, to) *** 155,161 **** - --- 164,177 ---- } buffer = xmalloc (file_size + 1); + #ifdef __MSDOS__ + /* The actual number read might be smaller, due to CRs being + stripped. */ + file_size = read (file, buffer, file_size); + if (file_size < 0) + #else if (read (file, buffer, file_size) != file_size) + #endif { error_and_exit: if (file >= 0) *************** history_truncate_file (fname, lines) *** 229,234 **** - --- 245,260 ---- filename = history_filename (fname); file = open (filename, O_RDONLY|O_BINARY, 0666); + #ifdef __MSDOS__ + /* MSDOS doesn't allow leading dots in file names. Try again + with the dot replaced by an underscore. */ + if (file < 0 && !fname) + { + filename[strlen (filename) - 8] = '_'; + file = open (filename, O_RDONLY|O_BINARY, 0666); + } + #endif + if (file == -1 || fstat (file, &finfo) == -1) goto truncate_exit; *************** history_truncate_file (fname, lines) *** 275,281 **** truncate to. */ if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { ! write (file, buffer + i, file_size - i); close (file); } - --- 301,307 ---- truncate to. */ if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { ! write (file, buffer + i, chars_read - i); close (file); } *************** history_do_write (filename, nelements, o *** 302,311 **** - --- 328,353 ---- mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY; output = history_filename (filename); + if ((file = open (output, mode, 0600)) == -1) { + #ifdef __MSDOS__ + /* MSDOS doesn't allow leading dots in file names. If this is + the default file name, try again with the dot replaced by an + underscore. */ + if (!filename) + { + output[strlen (output) - 8] = '_'; + if ((file = open (output, mode, 0600)) == -1) + { + FREE (output); + return (errno); + } + } + #else FREE (output); return (errno); + #endif } if (nelements > history_length) *** cvs/readline/display.c Mon Apr 26 21:30:26 1999 - --- ./readline/display.c Sat May 22 18:51:58 1999 *************** _rl_move_vert (to) *** 1107,1112 **** - --- 1107,1113 ---- { int row, col; + fflush (rl_outstream); /* make sure the cursor pos is current! */ ScreenGetCursor (&row, &col); ScreenSetCursor ((row + to - _rl_last_v_pos), col); } *************** void *** 1333,1339 **** _rl_clear_to_eol (count) int count; { ! #if !defined (__GO32__) if (term_clreol) tputs (term_clreol, 1, _rl_output_character_function); else if (count) - --- 1334,1340 ---- _rl_clear_to_eol (count) int count; { ! #ifndef __GO32__ if (term_clreol) tputs (term_clreol, 1, _rl_output_character_function); else if (count) *************** space_to_eol (count) *** 1358,1369 **** void _rl_clear_screen () { ! #if !defined (__GO32__) if (term_clrpag) tputs (term_clrpag, 1, _rl_output_character_function); else - - #endif /* !__GO32__ */ crlf (); } /* Insert COUNT characters from STRING to the output stream. */ - --- 1359,1373 ---- void _rl_clear_screen () { ! #if defined (__GO32__) ! ScreenClear (); /* FIXME: only works in text modes */ ! ScreenSetCursor (0, 0); /* term_clrpag is "cl" which homes the cursor */ ! #else /* !__GO32__ */ if (term_clrpag) tputs (term_clrpag, 1, _rl_output_character_function); else crlf (); + #endif /* !__GO32__ */ } /* Insert COUNT characters from STRING to the output stream. */ *************** insert_some_chars (string, count) *** 1372,1391 **** char *string; int count; { ! #if defined (__GO32__) ! int row, col, width; ! char *row_start; ! ! ScreenGetCursor (&row, &col); ! width = ScreenCols (); ! row_start = ScreenPrimary + (row * width); ! ! memcpy (row_start + col + count, row_start + col, width - col - count); ! ! /* Place the text on the screen. */ ! _rl_output_some_chars (string, count); ! #else /* !_GO32 */ ! /* If IC is defined, then we do not have to "enter" insert mode. */ if (term_IC) { - --- 1376,1382 ---- char *string; int count; { ! #ifndef __GO32__ /* If IC is defined, then we do not have to "enter" insert mode. */ if (term_IC) { *************** static void *** 1426,1443 **** delete_chars (count) int count; { ! #if defined (__GO32__) ! int row, col, width; ! char *row_start; ! ! ScreenGetCursor (&row, &col); ! width = ScreenCols (); ! row_start = ScreenPrimary + (row * width); ! ! memcpy (row_start + col, row_start + col + count, width - col - count); ! memset (row_start + width - count, 0, count * 2); ! #else /* !_GO32 */ ! if (count > screenwidth) /* XXX */ return; - --- 1417,1423 ---- delete_chars (count) int count; { ! #ifndef __GO32__ if (count > screenwidth) /* XXX */ return; ------- End of forwarded message ------- >From dj@delorie.com Sun Jun 27 10:50:00 1999 From: DJ Delorie To: gdb-patches@sourceware.cygnus.com Subject: [eliz@is.elta.co.il: GDB: fine print in 387 info] Date: Sun, 27 Jun 1999 10:50:00 -0000 Message-id: <199906271749.NAA32056@envy.delorie.com> X-SW-Source: 1999-q2/msg00168.html Content-length: 2154 ------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 19:19:16 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz@is To: DJ Delorie cc: Robert Hoehne Subject: GDB: fine print in 387 info Content-Type: TEXT/PLAIN; charset=US-ASCII 1999-06-26 Eli Zaretskii * i387-tdep.c (print_387_status_word): Don't print colons or semi-colons if there's no data to follow/preceed them. *** cvs/gdb/i387-tdep.c Fri Apr 16 04:34:02 1999 - --- ./gdb/i387-tdep.c Wed Jun 16 22:20:34 1999 *************** void *** 88,97 **** print_387_status_word (status) unsigned int status; { ! printf_unfiltered ("status %s: ", local_hex_string (status)); if (status & 0xff) { ! printf_unfiltered ("exceptions:"); if (status & 0x0001) printf_unfiltered (" INVALID"); if (status & 0x0002) printf_unfiltered (" DENORM"); if (status & 0x0004) printf_unfiltered (" DIVZ"); - --- 88,97 ---- print_387_status_word (status) unsigned int status; { ! printf_unfiltered ("status %s", local_hex_string (status)); if (status & 0xff) { ! printf_unfiltered (": exceptions:"); if (status & 0x0001) printf_unfiltered (" INVALID"); if (status & 0x0002) printf_unfiltered (" DENORM"); if (status & 0x0004) printf_unfiltered (" DIVZ"); *************** print_387_status_word (status) *** 99,106 **** if (status & 0x0010) printf_unfiltered (" UNDERF"); if (status & 0x0020) printf_unfiltered (" LOS"); if (status & 0x0040) printf_unfiltered (" FPSTACK"); - - printf_unfiltered ("; "); } printf_unfiltered ("flags: %d%d%d%d; ", (status & 0x4000) != 0, (status & 0x0400) != 0, - --- 99,106 ---- if (status & 0x0010) printf_unfiltered (" UNDERF"); if (status & 0x0020) printf_unfiltered (" LOS"); if (status & 0x0040) printf_unfiltered (" FPSTACK"); } + printf_unfiltered ("; "); printf_unfiltered ("flags: %d%d%d%d; ", (status & 0x4000) != 0, (status & 0x0400) != 0, ------- End of forwarded message ------- >From jimb@cygnus.com Mon Jun 28 13:05:00 1999 From: Jim Blandy To: Stan Shebs Cc: gdb-patches@sourceware.cygnus.com Subject: GDB produces unnecessary warnings Date: Mon, 28 Jun 1999 13:05:00 -0000 Message-id: <199906282004.PAA02132@zwingli.cygnus.com> X-SW-Source: 1999-q2/msg00169.html Content-length: 2203 I'm not sure how worthwhile this is, since the code that produced the warnings is now gone from GDB, with David Taylor's change of Mar 31. But if you think it's interesting, I'll commit it. 1999-06-28 Jim Blandy * gdb.c++/derivation.exp ("print g_instance.a", "print g_instance.b", "print g_instance.c"): Fail if the debugger produces a warning. The compiler thinks these expressions are fine, so GDB should too. Index: derivation.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.c++/derivation.exp,v retrieving revision 1.3 diff -c -r1.3 derivation.exp *** derivation.exp 1999/04/02 02:22:42 1.3 --- derivation.exp 1999/06/28 20:00:52 *************** *** 1,4 **** ! # Copyright (C) 1998 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by --- 1,4 ---- ! # Copyright (C) 1998, 1999 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by *************** *** 265,270 **** --- 265,274 ---- send_gdb "print g_instance.a\n" gdb_expect { + -re "warning.*$gdb_prompt $" { + # The compiler doesn't think this is ambiguous. + fail "print value of g_instance.a" + } -re ".\[0-9\]* = 15.*$gdb_prompt $" { pass "print value of g_instance.a" } *************** *** 274,279 **** --- 278,287 ---- send_gdb "print g_instance.b\n" gdb_expect { + -re "warning.*$gdb_prompt $" { + # The compiler doesn't think this is ambiguous. + fail "print value of g_instance.b" + } -re ".\[0-9\]* = 16.*$gdb_prompt $" { pass "print value of g_instance.b" } *************** *** 283,288 **** --- 291,300 ---- send_gdb "print g_instance.c\n" gdb_expect { + -re "warning.*$gdb_prompt $" { + # The compiler doesn't think this is ambiguous. + fail "print value of g_instance.c" + } -re ".\[0-9\]* = 17.*$gdb_prompt $" { pass "print value of g_instance.c" } >From jimb@cygnus.com Mon Jun 28 13:12:00 1999 From: Jim Blandy To: David Taylor Cc: gdb-patches@sourceware.cygnus.com Subject: RFA: printing true characters when lang is C Date: Mon, 28 Jun 1999 13:12:00 -0000 Message-id: <199906282011.PAA02140@zwingli.cygnus.com> X-SW-Source: 1999-q2/msg00170.html Content-length: 1535 unpack_long returns a long long; the code passed it to printf, with a %u or %d format specifier. We shouldn't use %llu / %lld, since those aren't portable. Note that this doesn't affect the C character type --- it only affects true character types, like Java's. And, with the patch I committed a few days ago, like the type used by 'print/c'. (Thanks for catching this, Stan.) 1999-06-18 Jim Blandy * c-valprint.c (c_val_print): Cast a character's numeric value from long long to int before trying to print it with %u or %d. I don't think we'll find a language with characters wider than a long. Index: c-valprint.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/c-valprint.c,v retrieving revision 2.41 diff -c -c -b -F'^(' -r2.41 c-valprint.c *** c-valprint.c 1999/01/05 17:08:19 2.41 --- c-valprint.c 1999/06/18 07:08:10 *************** *** 402,409 **** } else { ! fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%u" : "%d", ! unpack_long (type, valaddr + embedded_offset)); fputs_filtered (" ", stream); LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset), stream); } --- 402,409 ---- } else { ! fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%lu" : "%ld", ! (long) unpack_long (type, valaddr + embedded_offset)); fputs_filtered (" ", stream); LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset), stream); } >From jimb@cygnus.com Mon Jun 28 13:43:00 1999 From: Jim Blandy To: DJ Delorie Cc: gdb-patches@sourceware.cygnus.com, Eli Zaretskii Subject: Re: [eliz@is.elta.co.il: GDB: fine print in 387 info] Date: Mon, 28 Jun 1999 13:43:00 -0000 Message-id: References: <199906271749.NAA32056@envy.delorie.com> X-SW-Source: 1999-q2/msg00171.html Content-length: 303 > 1999-06-26 Eli Zaretskii > > * i387-tdep.c (print_387_status_word): Don't print colons or > semi-colons if there's no data to follow/preceed them. I'm about to merge a patch from Bill Metzenthen which changes this code a lot. So I don't think this patch should be applied. >From ac131313@cygnus.com Mon Jun 28 19:15:00 1999 From: Andrew Cagney To: gdb-patches@sourceware.cygnus.com Subject: gdb/testsuite/gdb.base/lib/gdb.exp:gdb_expect_list() consistent pass/fail Date: Mon, 28 Jun 1999 19:15:00 -0000 Message-id: <37782C24.B53DDBAF@cygnus.com> X-SW-Source: 1999-q2/msg00172.html Content-length: 2733 FYI, I've just checked in the attached patch. It modifies the procedure gdb_expect_list() so that it outputs a constant number of tests (pass or fail) using a consistent format. This should make it easier to compare before/after results. Thanks to Fernando Nasser for reporting this problem. Andrew Tue Jun 29 11:56:06 1999 Andrew Cagney * lib/gdb.exp (gdb_expect_list): Output one message per pattern in a consistent format. Index: lib/gdb.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.144 diff -p -r1.144 gdb.exp *** gdb.exp 1999/06/25 23:39:42 1.144 --- gdb.exp 1999/06/29 02:07:10 *************** proc gdb_expect { args } { *** 1105,1141 **** proc gdb_expect_list {test sentinal list} { global gdb_prompt set index 0 ! while { ${index} >= 0 && ${index} < [llength ${list}] } { set pattern [lindex ${list} ${index}] set index [expr ${index} + 1] if { ${index} == [llength ${list}] } { ! gdb_expect { ! -re "${pattern}${sentinal}" { ! pass "${test} (sentinal)" } ! timeout { ! fail "(timeout on sentinal) ${test}" ! set index -1 ! } } } else { ! gdb_expect { ! -re "${pattern}" { ! pass "${test} (line ${index})" ! } ! -re "${sentinal}" { ! fail "${test} (line ${index})" ! set index -1 ! } ! timeout { ! fail "(timeout on line ${index}) ${test}" ! set index -1 } } } - } - if { ${index} >= 0 } { - pass "${test}" } } --- 1105,1147 ---- proc gdb_expect_list {test sentinal list} { global gdb_prompt set index 0 ! set ok 1 ! while { ${index} < [llength ${list}] } { set pattern [lindex ${list} ${index}] set index [expr ${index} + 1] if { ${index} == [llength ${list}] } { ! if { ${ok} } { ! gdb_expect { ! -re "${pattern}${sentinal}" { ! pass "${test}, pattern ${index} + sentinal" ! } ! timeout { ! fail "${test}, pattern ${index} + sentinal (timeout)" ! set ok 0 ! } } ! } else { ! fail "${test}, pattern ${index} + sentinal" } } else { ! if { ${ok} } { ! gdb_expect { ! -re "${pattern}" { ! pass "${test}, pattern ${index}" ! } ! -re "${sentinal}" { ! fail "${test}, pattern ${index}" ! set ok 0 ! } ! timeout { ! fail "${test}, pattern ${index} (timeout)" ! set ok 0 ! } } + } else { + fail "${test}, pattern ${index}" } } } }