[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gdb] Re: Suspected bug in GDB 5.0 -- SIGSEV sent for unaligned acce
From: |
Peter.Schauer |
Subject: |
[Bug-gdb] Re: Suspected bug in GDB 5.0 -- SIGSEV sent for unaligned access instead of SIGBUS |
Date: |
Sun, 17 Sep 2000 13:41:17 MET DST |
Older versions of GDB had this in procfs.c:
#endif /* not FAULTED_USE_SIGINFO */
default:
/* Use the signal which the kernel assigns. This is better than
trying to second-guess it from the fault. In fact, I suspect
that FLTACCESS can be either SIGSEGV or SIGBUS. */
#ifdef UNIXWARE
statval = ((pi->prstatus.pr_lwp.pr_info.si_signo) << 8) | 0177;
#else
statval = ((pi->prstatus.pr_info.si_signo) << 8) | 0177;
#endif
break;
which has been left out during a procfs.c overhaul and causes the behaviour
you are observing.
The new code has some FIXMEs though:
switch (what) { /* FIXME: FAULTED_USE_SIGINFO */
/* FIXME: use si_signo where possible. */
default: /* FIXME: use si_signo if possible for fault */
so it seems that the problem is known.
I do not know enough about other procfs implementations (UNIXWARE, IRIX etc.)
to come up with a proper fix, sorry.
> Dear gdb maintainer,
>
> Versions of gdb prior to 5.0 delivered a SIGBUS
> for an unaligned access. The shell has this behavior,
> too. However, gdb 5.0 interprets unaligned accesses
> as SIGSEGV. This is a problem when debugging programs
> that use SIGBUS.
>
> Here is an example of a program with an unaligned
> access running in gdb 4.17 and gdb 5.0:
>
> /mnt3/jlp> gcc -g signal.c
> /mnt3/jlp> a.out
> Bus Error
> /mnt3/jlp> cat signal.c
> int main()
> {
> union {
> char c[4];
> long *lP;
> } u;
>
> *u.lP = malloc(5);
> u.c[3]++;
>
> *u.lP = 42;
> return 0;
> }
> /mnt3/jlp>
>
> /mnt3/jlp> /usr/local/bin/gdb-4.17 a.out
> GNU gdb 4.17
> Copyright 1998 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "sparc-sun-solaris2.6"...
> (gdb) b main
> Breakpoint 1 at 0x10564: file signal.c, line 10.
> (gdb) r
> Starting program: /mnt3/jlp/a.out
> in gdb. .cshrc was not sourced
>
> Breakpoint 1, main () at signal.c:10
> 10 *u.lP = malloc(4);
> (gdb) n
> 11 u.c[3]++;
> (gdb)
> 13 *u.lP = 42;
> (gdb)
>
> Program terminated with signal SIGBUS, Bus error.
> The program no longer exists.
> (gdb) quit
> /mnt3/jlp> gdb a.out
> GNU gdb 5.0 (UI_OUT)
> Copyright 2000 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "sparc-sun-solaris2.7"...
> (gdb) b main
> Breakpoint 1 at 0x10564: file signal.c, line 10.
> (gdb) r
> Starting program: /mnt3/jlp/a.out
> in gdb. .cshrc was not sourced
>
> Breakpoint 1, main () at signal.c:10
> 10 *u.lP = malloc(4);
> (gdb) n
> 11 u.c[3]++;
> (gdb)
> 13 *u.lP = 42;
> (gdb)
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00010590 in main () at signal.c:13
> 13 *u.lP = 42;
> (gdb) quit
> The program is running. Exit anyway? (y or n) y
> /mnt3/jlp>
>
>
>
--
Peter Schauer address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-gdb] Re: Suspected bug in GDB 5.0 -- SIGSEV sent for unaligned access instead of SIGBUS,
Peter.Schauer <=