From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elena Zannoni To: Christopher Faylor Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA?] Windows cleanup Date: Wed, 06 Jun 2001 10:29:00 -0000 Message-id: <15134.26745.381557.529111@kwikemart.cygnus.com> References: <20010530232225.A19889@redhat.com> X-SW-Source: 2001-06/msg00080.html The partial-stab.h change is unrelated, right? I think it is another patch, another thread. http://sources.redhat.com/ml/gdb-patches/2001-05/msg00489.html Elena Christopher Faylor writes: > I should probably submit these as two patches. One part cleans up some > cygwin ifdefs, the other eliminates _MSC_VER tests. > > I think that all of these qualify as obvious fixes, given that I'm the > Cygwin maintainer and _MSC_VER is no longer supported, however, I'd > like someone to verify that I properly whacked the ifdefs since I can't > really test things like "nindy-share". > > Thanks to Eli for pointing all of this out a while ago. I love > eliminating obsolete stuff. > > cgf > > Wed May 30 23:02:44 2001 Christopher Faylor > > * gnu-regex.c: Eliminate obsolete check for _MSC_VER. > * utils.c (quit): Ditto. > * values.c (unpack_double): Ditto. > * defs.h: Ditto. > * m32-rom.c: Ditto. > * p-exp.y: Ditto. > * ser-e7kpc.c: Ditto. Define WIN32_LEAN_AND_MEAN under _WIN32, for > faster compilation. > (get_ds_base): Remove _MSC_VER version of this function. > * utils.c (notice_quit): Ditto. > * values.c (unpack_double): Remove obsolete check for _MSC_VER. > * nindy-share/ttyflush.c: Ditto. > * rdi-share/host.h: Ditto. > > * main.c (captured_main): Eliminate special Cygwin checks. > * ser-tcp.c: Remove unneeded __CYGWIN__ guard against system include. > > Index: gnu-regex.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/gnu-regex.c,v > retrieving revision 1.5 > diff -c -2 -0 -p -r1.5 gnu-regex.c > *** gnu-regex.c 2001/03/06 08:21:07 1.5 > --- gnu-regex.c 2001/05/30 21:34:57 > *************** static reg_errcode_t compile_range _RE_A > *** 1573,1627 **** > relative address offset by the three bytes the jump itself occupies. */ > #define STORE_JUMP(op, loc, to) \ > store_op1 (op, loc, (int) ((to) - (loc) - 3)) > > /* Likewise, for a two-argument jump. */ > #define STORE_JUMP2(op, loc, to, arg) \ > store_op2 (op, loc, (int) ((to) - (loc) - 3), arg) > > /* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ > #define INSERT_JUMP(op, loc, to) \ > insert_op1 (op, loc, (int) ((to) - (loc) - 3), b) > > /* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ > #define INSERT_JUMP2(op, loc, to, arg) \ > insert_op2 (op, loc, (int) ((to) - (loc) - 3), arg, b) > > > /* This is not an arbitrary limit: the arguments which represent offsets > into the pattern are two bytes long. So if 2^16 bytes turns out to > be too small, many things would have to change. */ > ! /* Any other compiler which, like MSC, has allocation limit below 2^16 > ! bytes will have to use approach similar to what was done below for > ! MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up > ! reallocating to 0 bytes. Such thing is not going to work too well. > ! You have been warned!! */ > ! #if defined _MSC_VER && !defined WIN32 > ! /* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. > ! The REALLOC define eliminates a flurry of conversion warnings, > ! but is not required. */ > ! # define MAX_BUF_SIZE 65500L > ! # define REALLOC(p,s) realloc ((p), (size_t) (s)) > ! #else > ! # define MAX_BUF_SIZE (1L << 16) > ! # define REALLOC(p,s) realloc ((p), (s)) > ! #endif > > /* Extend the buffer by twice its current size via realloc and > reset the pointers that pointed into the old block to point to the > correct places in the new one. If extending the buffer results in it > being larger than MAX_BUF_SIZE, then flag memory exhausted. */ > #define EXTEND_BUFFER() \ > do { \ > unsigned char *old_buffer = bufp->buffer; \ > if (bufp->allocated == MAX_BUF_SIZE) \ > return REG_ESIZE; \ > bufp->allocated <<= 1; \ > if (bufp->allocated > MAX_BUF_SIZE) \ > bufp->allocated = MAX_BUF_SIZE; \ > bufp->buffer = (unsigned char *) REALLOC (bufp->buffer, bufp->allocated);\ > if (bufp->buffer == NULL) \ > return REG_ESPACE; \ > /* If the buffer moved, move all the pointers into it. */ \ > if (old_buffer != bufp->buffer) \ > { \ > b = (b - old_buffer) + bufp->buffer; \ > --- 1573,1614 ---- > relative address offset by the three bytes the jump itself occupies. */ > #define STORE_JUMP(op, loc, to) \ > store_op1 (op, loc, (int) ((to) - (loc) - 3)) > > /* Likewise, for a two-argument jump. */ > #define STORE_JUMP2(op, loc, to, arg) \ > store_op2 (op, loc, (int) ((to) - (loc) - 3), arg) > > /* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ > #define INSERT_JUMP(op, loc, to) \ > insert_op1 (op, loc, (int) ((to) - (loc) - 3), b) > > /* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ > #define INSERT_JUMP2(op, loc, to, arg) \ > insert_op2 (op, loc, (int) ((to) - (loc) - 3), arg, b) > > > /* This is not an arbitrary limit: the arguments which represent offsets > into the pattern are two bytes long. So if 2^16 bytes turns out to > be too small, many things would have to change. */ > ! #define MAX_BUF_SIZE (1L << 16) > ! #define REALLOC(p,s) realloc ((p), (s)) > > /* Extend the buffer by twice its current size via realloc and > reset the pointers that pointed into the old block to point to the > correct places in the new one. If extending the buffer results in it > being larger than MAX_BUF_SIZE, then flag memory exhausted. */ > #define EXTEND_BUFFER() \ > do { \ > unsigned char *old_buffer = bufp->buffer; \ > if (bufp->allocated == MAX_BUF_SIZE) \ > return REG_ESIZE; \ > bufp->allocated <<= 1; \ > if (bufp->allocated > MAX_BUF_SIZE) \ > bufp->allocated = MAX_BUF_SIZE; \ > bufp->buffer = (unsigned char *) REALLOC (bufp->buffer, bufp->allocated);\ > if (bufp->buffer == NULL) \ > return REG_ESPACE; \ > /* If the buffer moved, move all the pointers into it. */ \ > if (old_buffer != bufp->buffer) \ > { \ > b = (b - old_buffer) + bufp->buffer; \ > Index: main.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/main.c,v > retrieving revision 1.10 > diff -c -2 -0 -p -r1.10 main.c > *** main.c 2001/05/07 19:03:11 1.10 > --- main.c 2001/05/30 21:34:58 > *************** int dbx_commands = 0; > *** 73,116 **** > struct ui_file *gdb_stdout; > struct ui_file *gdb_stderr; > struct ui_file *gdb_stdlog; > struct ui_file *gdb_stdtarg; > > /* Used to initialize error() - defined in utils.c */ > > extern void error_init (void); > > /* Whether to enable writing into executable and core files */ > extern int write_files; > > static void print_gdb_help (struct ui_file *); > > /* These two are used to set the external editor commands when gdb is farming > out files to be edited by another program. */ > > extern int enable_external_editor; > extern char *external_editor_command; > > - #ifdef __CYGWIN__ > - #include /* for cygwin32_conv_to_posix_path */ > - #endif > - > /* Call command_loop. If it happens to return, pass that through as a > non-zero return status. */ > > static int > captured_command_loop (void *data) > { > if (command_loop_hook == NULL) > command_loop (); > else > command_loop_hook (); > /* FIXME: cagney/1999-11-05: A correct command_loop() implementaton > would clean things up (restoring the cleanup chain) to the state > they were just prior to the call. Technically, this means that > the do_cleanups() below is redundant. Unfortunately, many FUNCs > are not that well behaved. do_cleanups should either be replaced > with a do_cleanups call (to cover the problem) or an assertion > check to detect bad FUNCs code. */ > do_cleanups (ALL_CLEANUPS); > /* If the command_loop returned, normally (rather than threw an > error) we try to quit. If the quit is aborted, catch_errors() > --- 73,112 ---- > *************** extern int gdbtk_test (char *); > *** 517,571 **** > { > /* Print all the junk at the top, with trailing "..." if we are about > to read a symbol file (possibly slowly). */ > print_gdb_version (gdb_stdout); > if (symarg) > printf_filtered (".."); > wrap_here (""); > gdb_flush (gdb_stdout); /* Force to screen during slow operations */ > } > > error_pre_print = "\n\n"; > quit_pre_print = error_pre_print; > > /* We may get more than one warning, don't double space all of them... */ > warning_pre_print = "\nwarning: "; > > /* Read and execute $HOME/.gdbinit file, if it exists. This is done > *before* all the command line arguments are processed; it sets > global parameters, which are independent of what file you are > debugging or what directory you are in. */ > - #ifdef __CYGWIN__ > - { > - char *tmp = getenv ("HOME"); > - > - if (tmp != NULL) > - { > - homedir = (char *) alloca (PATH_MAX + 1); > - cygwin32_conv_to_posix_path (tmp, homedir); > - } > - else > - homedir = NULL; > - } > - #else > homedir = getenv ("HOME"); > - #endif > if (homedir) > { > homeinit = (char *) alloca (strlen (homedir) + > strlen (gdbinit) + 10); > strcpy (homeinit, homedir); > strcat (homeinit, "/"); > strcat (homeinit, gdbinit); > > if (!inhibit_gdbinit) > { > catch_command_errors (source_command, homeinit, 0, RETURN_MASK_ALL); > } > > /* Do stats; no need to do them elsewhere since we'll only > need them if homedir is set. Make sure that they are > zero in case one of them fails (this guarantees that they > won't match if either exists). */ > > memset (&homebuf, 0, sizeof (struct stat)); > memset (&cwdbuf, 0, sizeof (struct stat)); > --- 513,553 ---- > Index: partial-stab.h > =================================================================== > RCS file: /cvs/uberbaum/gdb/partial-stab.h,v > retrieving revision 1.7 > diff -c -2 -0 -p -r1.7 partial-stab.h > *** partial-stab.h 2001/03/06 08:21:11 1.7 > --- partial-stab.h 2001/05/30 21:34:59 > *************** switch (CUR_SYMBOL_TYPE) > *** 583,626 **** > #ifdef SOFUN_ADDRESS_MAYBE_MISSING > /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit > value for the bottom of the text seg in those cases. */ > if (pst && textlow_not_set) > { > pst->textlow = > find_stab_function_addr (namestring, pst->filename, objfile); > textlow_not_set = 0; > } > #endif > /* End kludge. */ > > /* Keep track of the start of the last function so we > can handle end of function symbols. */ > last_function_start = CUR_SYMBOL_VALUE; > > /* In reordered executables this function may lie outside > the bounds created by N_SO symbols. If that's the case > use the address of this function as the low bound for > the partial symbol table. */ > ! if (textlow_not_set > ! || (pst && CUR_SYMBOL_VALUE < pst->textlow > ! && CUR_SYMBOL_VALUE > ! != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))) > { > pst->textlow = CUR_SYMBOL_VALUE; > textlow_not_set = 0; > } > #endif /* DBXREAD_ONLY */ > add_psymbol_to_list (namestring, p - namestring, > VAR_NAMESPACE, LOC_BLOCK, > &objfile->static_psymbols, > 0, CUR_SYMBOL_VALUE, > psymtab_language, objfile); > continue; > > /* Global functions were ignored here, but now they > are put into the global psymtab like one would expect. > They're also in the minimal symbol table. */ > case 'F': > CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); > #ifdef DBXREAD_ONLY > /* Kludges for ELF/STABS with Sun ACC */ > last_function_name = namestring; > --- 583,627 ---- > #ifdef SOFUN_ADDRESS_MAYBE_MISSING > /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit > value for the bottom of the text seg in those cases. */ > if (pst && textlow_not_set) > { > pst->textlow = > find_stab_function_addr (namestring, pst->filename, objfile); > textlow_not_set = 0; > } > #endif > /* End kludge. */ > > /* Keep track of the start of the last function so we > can handle end of function symbols. */ > last_function_start = CUR_SYMBOL_VALUE; > > /* In reordered executables this function may lie outside > the bounds created by N_SO symbols. If that's the case > use the address of this function as the low bound for > the partial symbol table. */ > ! if (pst > ! && (textlow_not_set > ! || (pst && CUR_SYMBOL_VALUE < pst->textlow > ! && CUR_SYMBOL_VALUE > ! != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))))) > { > pst->textlow = CUR_SYMBOL_VALUE; > textlow_not_set = 0; > } > #endif /* DBXREAD_ONLY */ > add_psymbol_to_list (namestring, p - namestring, > VAR_NAMESPACE, LOC_BLOCK, > &objfile->static_psymbols, > 0, CUR_SYMBOL_VALUE, > psymtab_language, objfile); > continue; > > /* Global functions were ignored here, but now they > are put into the global psymtab like one would expect. > They're also in the minimal symbol table. */ > case 'F': > CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); > #ifdef DBXREAD_ONLY > /* Kludges for ELF/STABS with Sun ACC */ > last_function_name = namestring; > Index: ser-tcp.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/ser-tcp.c,v > retrieving revision 1.4 > diff -c -2 -0 -p -r1.4 ser-tcp.c > *** ser-tcp.c 2001/04/05 02:02:13 1.4 > --- ser-tcp.c 2001/05/30 21:34:59 > *************** > *** 12,54 **** > This program is distributed in the hope that it will be useful, > but WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > GNU General Public License for more details. > > You should have received a copy of the GNU General Public License > along with this program; if not, write to the Free Software > Foundation, Inc., 59 Temple Place - Suite 330, > Boston, MA 02111-1307, USA. */ > > #include "defs.h" > #include "serial.h" > #include "ser-unix.h" > > #include > #include > #include > #include > #include > #include > - #ifndef __CYGWIN__ > - #include > - #endif > > #include > #include "gdb_string.h" > > static int tcp_open (serial_t scb, const char *name); > static void tcp_close (serial_t scb); > > void _initialize_ser_tcp (void); > > /* Open up a raw tcp socket */ > > static int > tcp_open (serial_t scb, const char *name) > { > char *port_str; > int port; > struct hostent *hostent; > struct sockaddr_in sockaddr; > int tmp; > char hostname[100]; > --- 12,51 ---- > Index: utils.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/utils.c,v > retrieving revision 1.40 > diff -c -2 -0 -p -r1.40 utils.c > *** utils.c 2001/04/19 23:56:13 1.40 > --- utils.c 2001/05/30 21:35:01 > *************** quit (void) > *** 851,918 **** > 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. */ > || current_target.to_terminal_ours == NULL) > fprintf_unfiltered (gdb_stderr, "Quit\n"); > 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 > - * into a message which is appended to the message > - * queue for the process. > - */ > - > void > notice_quit (void) > { > - int k = win32pollquit (); > - if (k == 1) > - quit_flag = 1; > - else if (k == 2) > - immediate_quit = 1; > - } > - > - #else /* !defined(_MSC_VER) */ > - > - void > - notice_quit (void) > - { > /* Done by signals */ > } > - > - #endif /* !defined(_MSC_VER) */ > > /* Control C comes here */ > void > request_quit (int signo) > { > quit_flag = 1; > /* Restore the signal handler. Harmless with BSD-style signals, needed > for System V-style signals. So just always do it, rather than worrying > about USG defines and stuff like that. */ > signal (signo, request_quit); > > #ifdef REQUEST_QUIT > REQUEST_QUIT; > #else > if (immediate_quit) > quit (); > #endif > } > > /* Memory management stuff (malloc friends). */ > --- 851,895 ---- > Index: values.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/values.c,v > retrieving revision 1.17 > diff -c -2 -0 -p -r1.17 values.c > *** values.c 2001/05/21 20:08:59 1.17 > --- values.c 2001/05/30 21:35:03 > *************** unpack_double (struct type *type, char * > *** 678,723 **** > > *invp = 0; /* Assume valid. */ > CHECK_TYPEDEF (type); > code = TYPE_CODE (type); > len = TYPE_LENGTH (type); > nosign = TYPE_UNSIGNED (type); > if (code == TYPE_CODE_FLT) > { > #ifdef INVALID_FLOAT > if (INVALID_FLOAT (valaddr, len)) > { > *invp = 1; > return 1.234567891011121314; > } > #endif > return extract_floating (valaddr, len); > } > else if (nosign) > { > /* Unsigned -- be sure we compensate for signed LONGEST. */ > - #if !defined (_MSC_VER) || (_MSC_VER > 900) > return (ULONGEST) unpack_long (type, valaddr); > - #else > - /* FIXME!!! msvc22 doesn't support unsigned __int64 -> double */ > - return (LONGEST) unpack_long (type, valaddr); > - #endif /* _MSC_VER */ > } > else > { > /* Signed -- we are OK with unpack_long. */ > return unpack_long (type, valaddr); > } > } > > /* Unpack raw data (copied from debugee, target byte order) at VALADDR > as a CORE_ADDR, assuming the raw data is described by type TYPE. > We don't assume any alignment for the raw data. Return value is in > host byte order. > > If you want functions and arrays to be coerced to pointers, and > references to be dereferenced, call value_as_pointer() instead. > > C++: It is assumed that the front-end has taken care of > all matters concerning pointers to members. A pointer > to member which reaches here is considered to be equivalent > to an INT (or some size). After all, it is only an offset. */ > --- 678,718 ---- >