From 5c1c5e6745dbf2352a962b54601f436ddeb49571 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Thu, 2 Apr 1992 18:00:10 +0000 Subject: [PATCH] Fix bug in values.c unpacking signed characters on hosts where the default character type is unsigned. Add some cases to the tables in procfs.c for constants defined in newer SVR4 systems and reorder the tests for ioctl support of resetting the inherit-on-fork flag to favor the latest method using PIOCRESET. --- gdb/ChangeLog | 10 ++++++++++ gdb/procfs.c | 46 ++++++++++++++++++++++++++++++++-------------- gdb/values.c | 2 +- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b3481a9f839..7e8159dc616 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Thu Apr 2 09:47:11 1992 Fred Fish (fnf@cygnus.com) + + * values.c (unpack_long): Fix unpacking error for signed chars + on hosts where the default character type is unsigned. + * procfs.c (pr_flag_table, pr_why_table): Add some entries + for newer SVR4 variants. + * procfs.c (proc_set_exec_trap): Reorder tests for ioctl's that + turn off trace inherit-on-fork flag to favor latest SVR4 method. + * procfs.c (mappingflags): Add support for MA_PHYS + Thu Apr 2 00:55:56 1992 John Gilmore (gnu at cygnus.com) * buildsym.c (read_struct_type): Avoid coredump when C++ diff --git a/gdb/procfs.c b/gdb/procfs.c index 407c65fe90a..dd322110482 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -136,6 +136,18 @@ static struct trans pr_flag_table[] = #endif #if defined (PR_ISSYS) PR_ISSYS, "PR_ISSYS", "Is a system process", +#endif +#if defined (PR_STEP) + PR_STEP, "PR_STEP", "Process has single step pending", +#endif +#if defined (PR_KLC) + PR_KLC, "PR_KLC", "Kill-on-last-close is in effect", +#endif +#if defined (PR_ASYNC) + PR_ASYNC, "PR_ASYNC", "Asynchronous stop is in effect", +#endif +#if defined (PR_PCOMPAT) + PR_PCOMPAT, "PR_PCOMPAT", "Ptrace compatibility mode in effect", #endif 0, NULL, NULL }; @@ -161,6 +173,9 @@ static struct trans pr_why_table[] = #endif #if defined (PR_JOBCONTROL) PR_JOBCONTROL, "PR_JOBCONTROL", "Default job control stop signal action", +#endif +#if defined (PR_SUSPENDED) + PR_SUSPENDED, "PR_SUSPENDED", "Process suspended", #endif 0, NULL, NULL }; @@ -1781,15 +1796,15 @@ proc_set_exec_trap () /* Turn off inherit-on-fork flag so that all grand-children of gdb start with tracing flags cleared. */ -#ifdef PIOCRFORK /* Standard SVR4 */ - (void) ioctl (fd, PIOCRFORK, NULL); -#else -#ifdef PIOCRESET /* iris (for example) */ +#if defined (PIOCRESET) /* New method */ { long pr_flags; pr_flags = PR_FORK; (void) ioctl (fd, PIOCRESET, &pr_flags); } +#else +#if defined (PIOCRFORK) /* Original method */ + (void) ioctl (fd, PIOCRFORK, NULL); #endif #endif } @@ -2612,15 +2627,18 @@ static char * mappingflags (flags) long flags; { - static char asciiflags[7]; + static char asciiflags[8]; - strcpy (asciiflags, "------"); - if (flags & MA_STACK) asciiflags[0] = 's'; - if (flags & MA_BREAK) asciiflags[1] = 'b'; - if (flags & MA_SHARED) asciiflags[2] = 's'; - if (flags & MA_READ) asciiflags[3] = 'r'; - if (flags & MA_WRITE) asciiflags[4] = 'w'; - if (flags & MA_EXEC) asciiflags[5] = 'x'; + strcpy (asciiflags, "-------"); +#if defined (MA_PHYS) + if (flags & MA_PHYS) asciiflags[0] = 'd'; +#endif + if (flags & MA_STACK) asciiflags[1] = 's'; + if (flags & MA_BREAK) asciiflags[2] = 'b'; + if (flags & MA_SHARED) asciiflags[3] = 's'; + if (flags & MA_READ) asciiflags[4] = 'r'; + if (flags & MA_WRITE) asciiflags[5] = 'w'; + if (flags & MA_EXEC) asciiflags[6] = 'x'; return (asciiflags); } @@ -3012,7 +3030,7 @@ info_proc_mappings (pip, summary) if (!summary) { printf_filtered ("Mapped address spaces:\n\n"); - printf_filtered ("\t%10s %10s %10s %10s %6s\n", + printf_filtered ("\t%10s %10s %10s %10s %7s\n", "Start Addr", " End Addr", " Size", @@ -3025,7 +3043,7 @@ info_proc_mappings (pip, summary) { for (prmap = prmaps; prmap -> pr_size; ++prmap) { - printf_filtered ("\t%#10x %#10x %#10x %#10x %6s\n", + printf_filtered ("\t%#10x %#10x %#10x %#10x %7s\n", prmap -> pr_vaddr, prmap -> pr_vaddr + prmap -> pr_size - 1, prmap -> pr_size, diff --git a/gdb/values.c b/gdb/values.c index 512cc64c8a0..895df77e300 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -649,7 +649,7 @@ unpack_long (type, valaddr) { if (len == sizeof (char)) { - char retval; + SIGNED char retval; /* plain chars might be unsigned on host */ bcopy (valaddr, &retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); return retval; -- 2.30.2