From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Snyder To: Andrew Cagney Cc: Alexandre Oliva , gdb-patches@sourceware.cygnus.com Subject: Re: GDB 5.0 won't build on GNU/Linux/sparc Date: Sun, 21 May 2000 09:25:00 -0000 Message-id: <39280D5C.1A74@cygnus.com> References: <392730E1.22BE968B@cygnus.com> X-SW-Source: 2000-05/msg00319.html Andrew Cagney wrote: > > Alexandre Oliva wrote: > > > > On May 20, 2000, Alexandre Oliva wrote: > > > > > On GNU/Linux/sparc, it builds correctly, but it still doesn't work > > > :-( child_resume is called with step==1, and aborts because > > > SOFTWARE_SINGLE_STEP_P is also 1. > > > > This patch fixes this problem, and now it appears to work (not that I > > have tested it extensively!) > > > > The problem was that, when resume issued the software single step > > command, it cleared `step'. Later on, it would test whether step was > > zero and think it had been asked to `continue'. Ok to install? > > > > ------------------------------------------------------------------------ > > Index: gdb/ChangeLog > > from Alexandre Oliva > > > > * infrun.c (resume): Do not change continue to step if we single > > step on software. > > I think this one needs more testing (wfi is dangerous at the best of > times). > Does anyone with one of the other targets with SOFTWARE_SINGLE_STEP_P=1 > see this problem (wince, rs6000?, sunos4?). It was only last year that I removed SOFTWARE_SINGLE_STEP_P from Solaris. It should be easy to put it back temporarily for testing. > (Alexandre, can you provide a concrete example as a reference point). Yes, please! Michael >From kettenis@wins.uva.nl Sun May 21 14:34:00 2000 From: Mark Kettenis To: gdb-patches@sourceware.cygnus.com Subject: [PATH] Fix stupid bug in i387-tdep.c:print_i387_value() Date: Sun, 21 May 2000 14:34:00 -0000 Message-id: <200005212134.e4LLY6M00401@delius.kettenis.local> X-SW-Source: 2000-05/msg00320.html Content-length: 1127 Argh, I made a stupid mistake in my last change to the logic behind "info float". Using this command will set some bytes on the stack to zero, which may crash GDB (or perhaps do some other bad things to it). I checked it in on both branches, just in case Andrew will spin another release from the 5.0 branch. Mark 2000-05-21 Mark Kettenis * i387-tdep.c (print_i387_value): Cast &value to (char *) in pointer arithmetic. Fixes a bug which manifested itself on FreeBSD. Index: i387-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/i387-tdep.c,v retrieving revision 1.3 diff -u -p -r1.3 i387-tdep.c --- i387-tdep.c 2000/04/12 00:22:56 1.3 +++ i387-tdep.c 2000/05/21 21:15:14 @@ -176,7 +176,8 @@ print_i387_value (char *raw) { /* Copy straight over, but take care of the padding. */ memcpy (&value, raw, FPU_REG_RAW_SIZE); - memset (&value + FPU_REG_RAW_SIZE, 0, sizeof (value) - FPU_REG_RAW_SIZE); + memset ((char *) &value + FPU_REG_RAW_SIZE, 0, + sizeof (value) - FPU_REG_RAW_SIZE); } else #endif >From ac131313@cygnus.com Sun May 21 20:37:00 2000 From: Andrew Cagney To: Mark Kettenis Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [PATH] Fix stupid bug in i387-tdep.c:print_i387_value() Date: Sun, 21 May 2000 20:37:00 -0000 Message-id: <3928AB4B.A4CADAD5@cygnus.com> References: <200005212134.e4LLY6M00401@delius.kettenis.local> X-SW-Source: 2000-05/msg00321.html Content-length: 487 Mark Kettenis wrote: > > Argh, I made a stupid mistake in my last change to the logic behind > "info float". Using this command will set some bytes on the stack to > zero, which may crash GDB (or perhaps do some other bad things to > it). I checked it in on both branches, just in case Andrew will spin > another release from the 5.0 branch. Even if there is never a re-spin (we can play that one by ear), I'll occasionally push out gdb 5.0.0.0.0.2000mmdd.tar.bz snapshots. Andrew >From ac131313@cygnus.com Sun May 21 22:12:00 2000 From: Andrew Cagney To: GDB Patches Subject: [event-loop] Can command_loop_marker() be replaced by null_cleanup()? Date: Sun, 21 May 2000 22:12:00 -0000 Message-id: <3928C1A3.DFECB9E0@cygnus.com> X-SW-Source: 2000-05/msg00322.html Content-length: 152 Hello, Looking at it, the two look very similar. Perhaphs, command_loop_marker() is used so that the specific cleanup is easier to identify? Andrew >From ac131313@cygnus.com Sun May 21 22:42:00 2000 From: Andrew Cagney To: GDB Patches Subject: [patch] remove make_cleanup_func from top.c. Date: Sun, 21 May 2000 22:42:00 -0000 Message-id: <3928C891.84475516@cygnus.com> X-SW-Source: 2000-05/msg00323.html Content-length: 11369 Just FYI, Andrew Mon May 22 15:21:38 2000 Andrew Cagney * top.h (command_loop_marker): Change signature to match make_cleanup_ftype. * top.c (command_loop_marker): Update. (command_loop, simplified_command_loop), event-top.c (command_handler): Remove cast using make_cleanup_func. * event-top.c (command_handler): Ditto. * top.c (do_chdir_cleanup): New function. (gdb_init): Use. Use xstrdup instead of strsave. * top.c (do_fclose_cleanup): New function. (source_command): Use. * top.c (do_restore_instream_cleanup): Rename source_cleanup. Change signature to match make_cleanup. (read_command_filem execute_user_command): Update. Remove cast using make_cleanup_func. * top.c (do_free_command_lines_cleanup, make_cleanup_free_command_lines): New funtions. (get_command_line, read_command_lines): Use. * top.c (arg_cleanup): Change signature to match make_cleanup. (setup_user_args): Remove cast using make_cleanup_func. Index: event-top.c =================================================================== RCS file: /cvs/src/src/gdb/event-top.c,v retrieving revision 1.5 diff -p -r1.5 event-top.c *** event-top.c 2000/03/30 18:54:28 1.5 --- event-top.c 2000/05/22 05:38:52 *************** command_handler (char *command) *** 487,493 **** quit_flag = 0; if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); ! old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0); #if defined(TUI) insert_mode = 0; --- 487,493 ---- quit_flag = 0; if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); ! old_chain = make_cleanup (command_loop_marker, 0); #if defined(TUI) insert_mode = 0; Index: top.c =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.11 diff -p -r1.11 top.c *** top.c 2000/04/26 12:41:48 1.11 --- top.c 2000/05/22 05:39:04 *************** static char *readline_line_completion_fu *** 76,82 **** /* NOTE 1999-04-29: this function will be static again, after we make the event loop be the default command loop for gdb, and we merge event-top.c into this file, top.c */ ! /* static */ void command_loop_marker PARAMS ((int)); static void while_command PARAMS ((char *, int)); --- 76,82 ---- /* NOTE 1999-04-29: this function will be static again, after we make the event loop be the default command loop for gdb, and we merge event-top.c into this file, top.c */ ! /* static */ void command_loop_marker (void *); static void while_command PARAMS ((char *, int)); *************** static char *locate_arg PARAMS ((char *) *** 101,107 **** static char *insert_args PARAMS ((char *)); ! static void arg_cleanup PARAMS ((void)); static void init_main PARAMS ((void)); --- 101,107 ---- static char *insert_args PARAMS ((char *)); ! static void arg_cleanup (void *); static void init_main PARAMS ((void)); *************** static void set_debug PARAMS ((char *, i *** 157,164 **** static void disconnect PARAMS ((int)); #endif ! static void source_cleanup PARAMS ((FILE *)); /* Default command line prompt. This is overriden in some configs. */ #ifndef DEFAULT_PROMPT --- 157,166 ---- static void disconnect PARAMS ((int)); #endif ! static void do_restore_instream_cleanup (void *stream); + static struct cleanup *make_cleanup_free_command_lines (struct command_line **); + /* Default command line prompt. This is overriden in some configs. */ #ifndef DEFAULT_PROMPT *************** static int source_error_allocated; *** 760,767 **** user-defined command). */ static void ! source_cleanup (stream) ! FILE *stream; { /* Restore the previous input stream. */ instream = stream; --- 762,768 ---- user-defined command). */ static void ! do_restore_instream_cleanup (void *stream) { /* Restore the previous input stream. */ instream = stream; *************** read_command_file (stream) *** 774,780 **** { struct cleanup *cleanups; ! cleanups = make_cleanup ((make_cleanup_func) source_cleanup, instream); instream = stream; command_loop (); do_cleanups (cleanups); --- 775,781 ---- { struct cleanup *cleanups; ! cleanups = make_cleanup (do_restore_instream_cleanup, instream); instream = stream; command_loop (); do_cleanups (cleanups); *************** extern void init_proc PARAMS ((void)); *** 784,789 **** --- 785,799 ---- void (*pre_init_ui_hook) PARAMS ((void)); + #ifdef __MSDOS__ + void + do_chdir_cleanup (void *old_dir) + { + chdir (old_dir); + free (old_dir); + } + #endif + void gdb_init (argv0) char *argv0; *************** gdb_init (argv0) *** 799,805 **** #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 */ --- 809,815 ---- #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 (do_chdir_cleanup, xstrdup (current_directory)); #endif init_cmd_lists (); /* This needs to be done first */ *************** get_command_line (type, arg) *** 884,890 **** /* Allocate and build a new command line structure. */ cmd = build_command_line (type, arg); ! old_chain = make_cleanup ((make_cleanup_func) free_command_lines, &cmd); /* Read in the body of this command. */ if (recurse_read_control_structure (cmd) == invalid_control) --- 894,900 ---- /* Allocate and build a new command line structure. */ cmd = build_command_line (type, arg); ! old_chain = make_cleanup_free_command_lines (&cmd); /* Read in the body of this command. */ if (recurse_read_control_structure (cmd) == invalid_control) *************** if_command (arg, from_tty) *** 1261,1267 **** /* Cleanup */ static void ! arg_cleanup () { struct user_args *oargs = user_args; if (!user_args) --- 1271,1277 ---- /* Cleanup */ static void ! arg_cleanup (void *ignore) { struct user_args *oargs = user_args; if (!user_args) *************** setup_user_args (p) *** 1288,1294 **** args->next = user_args; user_args = args; ! old_chain = make_cleanup ((make_cleanup_func) arg_cleanup, 0); if (p == NULL) return old_chain; --- 1298,1304 ---- args->next = user_args; user_args = args; ! old_chain = make_cleanup (arg_cleanup, 0/*ignored*/); if (p == NULL) return old_chain; *************** execute_user_command (c, args) *** 1452,1458 **** /* Set the instream to 0, indicating execution of a user-defined function. */ ! old_chain = make_cleanup ((make_cleanup_func) source_cleanup, instream); instream = (FILE *) 0; while (cmdlines) { --- 1462,1468 ---- /* Set the instream to 0, indicating execution of a user-defined function. */ ! old_chain = make_cleanup (do_restore_instream_cleanup, instream); instream = (FILE *) 0; while (cmdlines) { *************** execute_command (p, from_tty) *** 1577,1584 **** gdb to use the event loop as the default command loop and we merge event-top.c into this file, top.c */ /* static */ void ! command_loop_marker (foo) ! int foo; { } --- 1587,1593 ---- gdb to use the event loop as the default command loop and we merge event-top.c into this file, top.c */ /* static */ void ! command_loop_marker (void *foo) { } *************** command_loop () *** 1609,1615 **** quit_flag = 0; if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); ! old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0); #if defined(TUI) /* A bit of paranoia: I want to make sure the "insert_mode" global --- 1618,1624 ---- quit_flag = 0; if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); ! old_chain = make_cleanup (command_loop_marker, 0); #if defined(TUI) /* A bit of paranoia: I want to make sure the "insert_mode" global *************** simplified_command_loop (read_input_func *** 1690,1696 **** quit_flag = 0; if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); ! old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0); /* Get a command-line. */ command = (*read_input_func) (instream == stdin ? --- 1699,1705 ---- quit_flag = 0; if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); ! old_chain = make_cleanup (command_loop_marker, 0); /* Get a command-line. */ command = (*read_input_func) (instream == stdin ? *************** read_command_lines (prompt_arg, from_tty *** 2864,2871 **** else { head = next; ! old_chain = make_cleanup ((make_cleanup_func) free_command_lines, ! &head); } tail = next; } --- 2873,2879 ---- else { head = next; ! old_chain = make_cleanup_free_command_lines (&head); } tail = next; } *************** free_command_lines (lptr) *** 2914,2919 **** --- 2922,2939 ---- l = next; } } + + static void + do_free_command_lines_cleanup (void *arg) + { + free_command_lines (arg); + } + + static struct cleanup * + make_cleanup_free_command_lines (struct command_line **arg) + { + return make_cleanup (do_free_command_lines_cleanup, arg); + } /* Add an element to the list of info subcommands. */ *************** source_cleanup_lines (args) *** 3748,3753 **** --- 3768,3779 ---- } /* ARGSUSED */ + static void + do_fclose_cleanup (void *stream) + { + fclose (stream); + } + void source_command (args, from_tty) char *args; *************** source_command (args, from_tty) *** 3776,3782 **** return; } ! make_cleanup ((make_cleanup_func) fclose, stream); old_lines.old_line = source_line_number; old_lines.old_file = source_file_name; --- 3802,3808 ---- return; } ! make_cleanup (do_fclose_cleanup, stream); old_lines.old_line = source_line_number; old_lines.old_file = source_file_name; Index: top.h =================================================================== RCS file: /cvs/src/src/gdb/top.h,v retrieving revision 1.1.1.11 diff -p -r1.1.1.11 top.h *** top.h 2000/02/03 04:14:30 1.1.1.11 --- top.h 2000/05/22 05:39:04 *************** extern void simplified_command_loop PARA *** 39,45 **** extern int quit_confirm PARAMS ((void)); extern void quit_force PARAMS ((char *, int)); extern void quit_command PARAMS ((char *, int)); ! extern void command_loop_marker PARAMS ((int)); extern int quit_cover PARAMS ((PTR)); extern void execute_command PARAMS ((char *, int)); --- 39,45 ---- extern int quit_confirm PARAMS ((void)); extern void quit_force PARAMS ((char *, int)); extern void quit_command PARAMS ((char *, int)); ! extern void command_loop_marker (void *); extern int quit_cover PARAMS ((PTR)); extern void execute_command PARAMS ((char *, int)); >From ac131313@cygnus.com Sun May 21 23:19:00 2000 From: Andrew Cagney To: GDB Patches Subject: [patch] procfs.c and make_cleanup_func Date: Sun, 21 May 2000 23:19:00 -0000 Message-id: <3928D157.9EB3E84E@cygnus.com> X-SW-Source: 2000-05/msg00324.html Content-length: 4743 Yawn :-) Andrew Mon May 22 15:49:13 2000 Andrew Cagney * procfs.c (info_proc_cmd): Use make_cleanup_freeargv. (proc_iterate_over_mappings): Use make_cleanup_close. (proc_get_LDT_entry): Ditto. (do_closedir_cleanup): New function. (proc_update_threads): Use. (do_destroy_procinfo_cleanup): New function. (info_proc_cmd): Use. Index: procfs.c =================================================================== RCS file: /cvs/src/src/gdb/procfs.c,v retrieving revision 1.11 diff -p -r1.11 procfs.c *** procfs.c 2000/05/10 17:38:16 1.11 --- procfs.c 2000/05/22 06:16:13 *************** static procinfo *find_procinfo_or_die PA *** 328,333 **** --- 328,334 ---- static procinfo *find_procinfo PARAMS ((int pid, int tid)); static procinfo *create_procinfo PARAMS ((int pid, int tid)); static void destroy_procinfo PARAMS ((procinfo *p)); + static void do_destroy_procinfo_cleanup (void *); static void dead_procinfo PARAMS ((procinfo *p, char *msg, int killp)); static int open_procinfo_files PARAMS ((procinfo *p, int which)); *************** destroy_procinfo (pi) *** 683,688 **** --- 684,695 ---- } } + static void + do_destroy_procinfo_cleanup (void *pi) + { + destroy_procinfo (pi); + } + enum { NOKILL, KILL }; /* *************** proc_iterate_over_mappings (func) *** 2633,2639 **** proc_error (pi, "proc_iterate_over_mappings (open)", __LINE__); /* Make sure it gets closed again. */ ! make_cleanup ((make_cleanup_func) close, (void *) map_fd); /* Allocate space for mapping (lifetime only for this function). */ map = alloca (sizeof (struct prmap)); --- 2640,2646 ---- proc_error (pi, "proc_iterate_over_mappings (open)", __LINE__); /* Make sure it gets closed again. */ ! make_cleanup_close (map_fd); /* Allocate space for mapping (lifetime only for this function). */ map = alloca (sizeof (struct prmap)); *************** proc_get_LDT_entry (pi, key) *** 2744,2750 **** return NULL; } /* Make sure it gets closed again! */ ! old_chain = make_cleanup ((make_cleanup_func) close, (void *) fd); /* Now 'read' thru the table, find a match and return it. */ while (read (fd, ldt_entry, sizeof (struct ssd)) == sizeof (struct ssd)) --- 2751,2757 ---- return NULL; } /* Make sure it gets closed again! */ ! old_chain = make_cleanup_close (fd); /* Now 'read' thru the table, find a match and return it. */ while (read (fd, ldt_entry, sizeof (struct ssd)) == sizeof (struct ssd)) *************** proc_update_threads (pi) *** 3013,3018 **** --- 3020,3031 ---- /* * Unixware and Solaris 6 (and later) version */ + static void + do_closedir_cleanup (void *dir) + { + closedir (dir); + } + int proc_update_threads (pi) procinfo *pi; *************** proc_update_threads (pi) *** 3051,3057 **** if ((dirp = opendir (pathname)) == NULL) proc_error (pi, "update_threads, opendir", __LINE__); ! old_chain = make_cleanup ((make_cleanup_func) closedir, dirp); while ((direntry = readdir (dirp)) != NULL) if (direntry->d_name[0] != '.') /* skip '.' and '..' */ { --- 3064,3070 ---- if ((dirp = opendir (pathname)) == NULL) proc_error (pi, "update_threads, opendir", __LINE__); ! old_chain = make_cleanup (do_closedir_cleanup, dirp); while ((direntry = readdir (dirp)) != NULL) if (direntry->d_name[0] != '.') /* skip '.' and '..' */ { *************** info_proc_cmd (args, from_tty) *** 5033,5039 **** if ((argv = buildargv (args)) == NULL) nomem (0); else ! make_cleanup ((make_cleanup_func) freeargv, argv); } while (argv != NULL && *argv != NULL) { --- 5046,5052 ---- if ((argv = buildargv (args)) == NULL) nomem (0); else ! make_cleanup_freeargv (argv); } while (argv != NULL && *argv != NULL) { *************** info_proc_cmd (args, from_tty) *** 5067,5073 **** /* No. So open a procinfo for it, but remember to close it again when finished. */ process = create_procinfo (pid, 0); ! make_cleanup ((make_cleanup_func) destroy_procinfo, process); if (!open_procinfo_files (process, FD_CTL)) proc_error (process, "info proc, open_procinfo_files", __LINE__); } --- 5080,5086 ---- /* No. So open a procinfo for it, but remember to close it again when finished. */ process = create_procinfo (pid, 0); ! make_cleanup (do_destroy_procinfo_cleanup, process); if (!open_procinfo_files (process, FD_CTL)) proc_error (process, "info proc, open_procinfo_files", __LINE__); } >From aoliva@cygnus.com Mon May 22 00:26:00 2000 From: Alexandre Oliva To: gdb-patches@sourceware.cygnus.com Subject: A few more am33 unsigned SP-offset fixes. Date: Mon, 22 May 2000 00:26:00 -0000 Message-id: X-SW-Source: 2000-05/msg00325.html Content-length: 335 On Apr 9th, I had posted a patch for the mn10300 sim that fixed insns involving SP offsets so that they'd zero-extend the offsets, as specified in the AM33 Instruction Manual. Unfortunately, I had missed some insns, because their leading comments were wrong :-( Here's a patch that fixes the comments and the insns. Ok to install?