[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#200351: set/longjump issue?



I never looked into set/longjmp and am not able to read
mips-assembler, but I guess the following means that
set/longjmp is broken. Branden, could you test the program
on necrotic to verify this might be the cause there, too?

The following is what I think dpkg is doing there without
anything unrelated (A is standard_startup and B is badusage):

-------------------test.c------------
#include <stdio.h>
#include <setjmp.h>

void A(jmp_buf *j) {
	int v;

	printf("[A\n");
	v = setjmp(*j);
	printf("A: setjmp returned %d\n",v);
	printf("A]\n");
}

void B(jmp_buf *j) {
	printf("[B\n");
	longjmp(*j,1);
	printf("B]\n");
}

int main() {
	jmp_buf j;

	printf("[main\n");
	A(&j);
	printf("...main...\n");
	B(&j);
	printf("main]\n");
	return 0;
}
-------------------------------------------------

-----------output of this is---------------------
[main
[A
A: setjmp returned 0
A]
...main...
[B
Segmentation fault
-------------------------------------------------

------------An gdb session-----------------------
GNU gdb 5.3.90_2003-08-24-cvs-debian
Copyright 2003 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 "mips-linux"...
(gdb) b main
Breakpoint 1 at 0x400a3c: file test.c, line 22.
(gdb) r
Starting program: /home/chroot/dpkg/test 

Breakpoint 1, main () at test.c:22
22		printf("[main\n");
(gdb) n
23		A(&j);
(gdb) s
A (j=0x7fff7cf8) at test.c:7
7		printf("[A\n");
(gdb) n
8		v = setjmp(*j);
(gdb) n
9		printf("A: setjmp returned %d\n",v);
(gdb) bt
#0  A (j=0x7fff7cf8) at test.c:9
#1  0x00400a70 in main () at test.c:23
(gdb) p *j
$1 = {{__jmpbuf = {{__pc = 0x4008fc, __sp = 0x7fff7c60, __regs = {4197264, 
          2147450452, 4197104, 1, 4196888, 2147447412, -4, 2147443240}, 
        __fp = 0x7fff7c60, __gp = 0x2ad09610, __fpc_csr = 4, __fpregs = {
          -nan(0xfffffffffffff), -nan(0xfffffffffffff), -nan(0xfffffffffffff), 
          -nan(0xfffffffffffff), -nan(0xfffffffffffff), 
          -nan(0xfffffffffffff)}}}, __mask_was_saved = 0, __saved_mask = {
      __val = {0, 0, 0, 718312976, 0, 1, 718312976, 716524848, 716524824, 0, 
        0, 268468272, 0, 4197264, 2147450452, 268468272, 4195888, 716282944, 
        718312976, 718312976, 0, 268468272, 4197264, 268468272, 4197160, 
        716313760, 0, 0, 0, 268468272, 716282968, 4197264}}}}
(gdb) n
10		printf("A]\n");
(gdb) n
11	}
(gdb) n
main () at test.c:24
24		printf("...main...\n");
(gdb) n
25		B(&j);
(gdb) s
B (j=0x7fff7cf8) at test.c:14
14		printf("[B\n");
(gdb) n
15		longjmp(*j,1);
(gdb) bt
#0  B (j=0x7fff7cf8) at test.c:15
#1  0x00400aac in main () at test.c:25
(gdb) p *j
$2 = {{__jmpbuf = {{__pc = 0x4008fc, __sp = 0x7fff7c60, __regs = {4197264, 
          2147450452, 4197104, 1, 4196888, 2147447412, -4, 2147443240}, 
        __fp = 0x7fff7c60, __gp = 0x2ad09610, __fpc_csr = 4, __fpregs = {
          -nan(0xfffffffffffff), -nan(0xfffffffffffff), -nan(0xfffffffffffff), 
          -nan(0xfffffffffffff), -nan(0xfffffffffffff), 
          -nan(0xfffffffffffff)}}}, __mask_was_saved = 0, __saved_mask = {
      __val = {0, 0, 0, 718312976, 0, 1, 718312976, 716524848, 716524824, 0, 
        0, 268468272, 0, 4197264, 2147450452, 268468272, 4195888, 716282944, 
        718312976, 718312976, 0, 268468272, 4197264, 268468272, 4197160, 
        716313760, 0, 0, 0, 268468272, 716282968, 4197264}}}}
(gdb) s
A (j=0x7fff7cf8) at test.c:9
9		printf("A: setjmp returned %d\n",v);
(gdb) bt
#0  A (j=0x7fff7cf8) at test.c:9
#1  0x00400b90 in __libc_csu_init ()
(gdb) p *j
$3 = {{__jmpbuf = {{__pc = 0x4008fc, __sp = 0x7fff7c60, __regs = {4197264, 
          2147450452, 4197104, 1, 4196888, 2147447412, -4, 2147443240}, 
        __fp = 0x7fff7c60, __gp = 0x2ad09610, __fpc_csr = 4, __fpregs = {
          -nan(0xfffffffffffff), -nan(0xfffffffffffff), -nan(0xfffffffffffff), 
          -nan(0xfffffffffffff), -nan(0xfffffffffffff), 
          -nan(0xfffffffffffff)}}}, __mask_was_saved = 0, __saved_mask = {
      __val = {0, 0, 0, 718312976, 0, 1, 718312976, 716524848, 716524824, 0, 
        0, 268468272, 0, 4197264, 2147450452, 268468272, 4195888, 716282944, 
        718312976, 718312976, 0, 268468272, 4197264, 268468272, 4197160, 
        716313760, 0, 0, 0, 268468272, 716282968, 4197264}}}}
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
A (j=0x7fff7cf8) at test.c:9
9		printf("A: setjmp returned %d\n",v);
(gdb) bt
#0  A (j=0x7fff7cf8) at test.c:9
#1  0x00400b90 in __libc_csu_init ()
(gdb) c
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) q
-------------------------------------------------

This system is:
Linux d03 2.4.19-r5k-ip22 #1 Wed Apr 9 13:23:23 CEST 2003 mips GNU/Linux
ii  libc6          2.3.2-6        GNU C Library: Shared libraries and Timezone
ii  gcc            3.3.1-2        The GNU C compiler.
system type		: SGI Indy
processor		: 0
cpu model		: R5000 V1.0  FPU V1.0
BogoMIPS		: 149.50
byteorder		: big endian
wait instruction	: yes
microsecond timers	: yes
tlb_entries		: 48
extra interrupt vector	: no
hardware watchpoint	: no
VCED exceptions		: not available
VCEI exceptions		: not available



Reply to: