pcnet/mingw32 debug info (help needed)
Apparently, the crash I'm getting is from the tcp/ip layer inside mingw libs (without debug info). libws2 to be more accurate. (Maybe it's a slirp/pcnet incompatibility ?)
here's the output of gdb. If anyone can make something from it, thanks in advance. Pls note I also did a comparison on the preprocessed output of pcnet.c between linux hosts and windows host, and htonl calls was the only difference (I realigned it, but it fails the same way).
==========================================================
$ gdb qemu.exe GNU gdb 5.2.1 Copyright 2002 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 "i686-pc-mingw32"... (gdb) set args -L . -cdrom slaxpro.iso -nic-pcnet (gdb) run Starting program: qemu.exe -L . -cdrom slaxpro.iso -nic-pcnet
Program received signal SIGSEGV, Segmentation fault. 0x77fa5575 in _libws2_32_a_iname ()
(gdb) where
#0 0x77fa5575 in _libws2_32_a_iname ()
#1 0x00000000 in ?? ()
==========================================================
Signature · 1 line
Christian
Hi,
Quoted 2 lines · Christian MICHON
here's the output of gdb. If anyone can make something from it, thanks in advance.
This is a part of backtrace output of gdb after I set IP address and ping 10.0.2.2. I seems that arp packet loops endlessly between pcnet and slirp.
I think something is wrong in pcnet_receive?
#27399 0x004552ac in pcnet_transmit (s=0xcdbf8e8)
at C:/msys/1.0/home/kazu/qemu-0.7.0/hw/pcnet.c:582
#27400 0x00455571 in pcnet_poll (s=0xcdbf8e8)
at C:/msys/1.0/home/kazu/qemu-0.7.0/hw/pcnet.c:625
#27401 0x00454fc3 in pcnet_receive (opaque=0xcdbf8e8, buf=0x22f7b0 "RT",
size=0) at C:/msys/1.0/home/kazu/qemu-0.7.0/hw/pcnet.c:538
#27402 0x004025f7 in slirp_output (pkt=0x22f7b0 "RT", pkt_len=42)
at C:/msys/1.0/home/kazu/qemu-0.7.0/vl.c:1402
#27403 0x0045b980 in arp_input (pkt=0xcdbfc30 "??????RT", pkt_len=42)
at C:/msys/1.0/home/kazu/qemu-0.7.0/slirp/slirp.c:583
#27404 0x0045b9dc in slirp_input (pkt=0xcdbfc30 "??????RT", pkt_len=42)
at C:/msys/1.0/home/kazu/qemu-0.7.0/slirp/slirp.c:602
#27405 0x00402611 in slirp_send_packet (nd=0x4e6a90, buf=0xcdbfc30 "??????RT",
size=42) at C:/msys/1.0/home/kazu/qemu-0.7.0/vl.c:1411
#27406 0x00402541 in qemu_send_packet (nd=0x4e6a90, buf=0xcdbfc30 "??????RT",
size=42) at C:/msys/1.0/home/kazu/qemu-0.7.0/vl.c:1353
#27407 0x004552ac in pcnet_transmit (s=0xcdbf8e8)
at C:/msys/1.0/home/kazu/qemu-0.7.0/hw/pcnet.c:582
#27408 0x00455571 in pcnet_poll (s=0xcdbf8e8)
at C:/msys/1.0/home/kazu/qemu-0.7.0/hw/pcnet.c:625
#27409 0x004556aa in pcnet_poll_timer (opaque=0xcdbf8e8)
at C:/msys/1.0/home/kazu/qemu-0.7.0/hw/pcnet.c:647
#27410 0x00455fa1 in pcnet_ioport_writew (opaque=0xcdbf8e8, addr=49202, val=0)
at C:/msys/1.0/home/kazu/qemu-0.7.0/hw/pcnet.c:915
#27411 0x004018f0 in cpu_outw (env=0x3d7358, addr=49202, val=0)
at C:/msys/1.0/home/kazu/qemu-0.7.0/vl.c:372
#27412 0x0078456b in code_gen_buffer ()
#27413 0x00404315 in main_loop () at C:/msys/1.0/home/kazu/qemu-0.7.0/vl.c:2700 #27414 0x00406c94 in main (argc=6, argv=0x3d27e8)
at C:/msys/1.0/home/kazu/qemu-0.7.0/vl.c:3719
(gdb) q
This backtrace said that as follows.
cpu_outputwpcnet_ioport_wirtew <- arp packet is send from pcnet to slirppcnet_poll_timerpcnet_pollpcnet_transmit
<snip>slirp_inputarp_input <- arp packet returns form slirp to pcnetslirp_outputpcnet_receive <- arp packet received by pcnetpcnet_poll <- I don't know why pcnet_poll is called againpcnet_transmit <- endless loop
Regards,
Kazu
Thx for this report, Kazu
I've a few questions:
1) how did you generate this gdb backtrace ?
2) which gemu guest did you use ?
3) you can apparently set IP address and ping the gateway. so your mingw32 compilation of qemu doesn't crash ? how did you manage this ? are you using the patch I updated or another one, and are you using qemu 0.7.0 or the CVS ?
thx in advance,
Christian
Quoted 10 lines · Kazu
Hi,
This is a part of backtrace output of gdb after I set IP address and ping 10.0.2.2.
I seems that arp packet loops endlessly between pcnet and slirp. I think something is wrong inpcnet_receive?#27399
0x004552acinpcnet_transmit(s=0xcdbf8e8)at C:/msys/1.0/home/kazu/qemu-0.7.0/hw/pcnet.c:582#27400
0x00455571inpcnet_poll(s=0xcdbf8e8)
Quoted 3 lines · Christian MICHON
I've a few questions:
1) how did you generate this gdb backtrace ?
It is necesssary to unoptimize qemu. Attached is a patch for it and pcnet I used.
Quoted 1 line
2) which gemu guest did you use ?
Qemu is 0.7.0 and a patch is from your post.
http://lists.gnu.org/archive/html/qemu-devel/2005-07/msg00254.html
Quoted 4 lines
3) you can apparently set IP address and ping the gateway. so your mingw32 compilation of qemu doesn't crash ? how did you manage this ? are you using the patch I updated
or another one, and are you using qemu 0.7.0 or the CVS ?
Apply attatched patch and ./configure --target-list=i386-softmmu and make.
I used RedHat 7.2 guest but I think it is the same as Linux. When I used dhcpcd, the program break without messages so that I disabled DHCP client and set IP address manually
# modprobe pcnet32 # ifconfig eth0 10.0.2.15 # ping 10.0.2.2
Then the program stops with segment fault and get backtrace.
This patch probably works on Linux. Please try to see differences between on Linux and on Windows if you can.
Regards,
Kazu
Makefile.target +5 -4
@@ -14,7 +14,7 @@ VPATH+=:$(SRC_PATH)/linux-user DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) endif -CFLAGS=-Wall -O2 -g -fno-strict-aliasing +CFLAGS=-Wall -O0 -g -fno-strict-aliasing #CFLAGS+=-Werror LDFLAGS=-g LIBS=
@@ -119,8 +119,9 @@ endif ifeq ($(ARCH),i386) -CFLAGS+=-fomit-frame-pointer -OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2 +#CFLAGS+=-fomit-frame-pointer +#OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2 +OP_CFLAGS=-O2 -g -fno-strict-aliasing -fomit-frame-pointer -mpreferred-stack-boundary=2 ifeq ($(HAVE_GCC3_OPTIONS),yes) OP_CFLAGS+= -falign-functions=0 -fno-gcse else
@@ -341,7 +342,7 @@ # Hardware support VL_OBJS+= ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o -VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o +VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o pcnet.o endif ifeq ($(TARGET_ARCH), ppc) VL_OBJS+= ppc.o ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
hw/apic.c +1 -1
@@ -118,7 +118,7 @@int i;for (i =0 ;i <8 ; i++) {if (tab[i] !=0 ) { -return i *32 +ffs (tab[i]) -1 ; +// return i * 32 + ffs(tab[i]) - 1; } }return -1 ;
hw/pc.c +4 -1
@@ -549,7 +549,10 @@if (pci_enabled) {for (i =0 ; i < nb_nics; i++) { -pci_ne2000_init (pci_bus, &nd_table[i]); +if (nic_pcnet) +pci_pcnet_init (pci_bus, &nd_table[i]); +else +pci_ne2000_init (pci_bus, &nd_table[i]); }pci_piix3_ide_init (pci_bus, bs_table); }else {
hw/pcnet.c +1209 -0
1,209 lines not on this page · raw message
hw/pcnet.h +603 -0
603 lines not on this page · raw message
slirp/slirp.c +1 -1
@@ -125,7 +125,7 @@void slirp_init (void ) { -// debug_init("/tmp/slirp.log", DEBUG_DEFAULT); +debug_init ("/tmp/slirp.log" ,DEBUG_DEFAULT );#ifdef _WIN32 {
target-i386/exec.h +7 -1
@@ -30,7 +30,8 @@#include "cpu-defs.h" /* at least 4 register variables are defined */ -register struct CPUX86State *env asm(AREG0); +//register struct CPUX86State *env asm(AREG0); +struct CPUX86State *env;#if TARGET_LONG_BITS >HOST_LONG_BITS
@@ -43,9 +44,14 @@/* XXX: use unsigned long instead of target_ulong - better code will be generated for 64 bit CPUs */ +#if 0 register target_ulong T0 asm(AREG1); register target_ulong T1 asm(AREG2); register target_ulong T2 asm(AREG3); +#endif +target_ulong T0 ; +target_ulong T1 ; +target_ulong T2 ;/* if more registers are available, we define some registers too */ #ifdef AREG4
target-i386/op.c +2 -1
@@ -17,8 +17,9 @@* License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - +#if 0 #define ASM_SOFTMMU +#endif #include "exec.h" /* n must be a constant to be efficient */
vl.c +7 -0
@@ -128,6 +128,7 @@QEMUTimer *gui_timer;int vm_running;int audio_enabled =0 ; +int nic_pcnet =0 ;int sb16_enabled =1 ;int adlib_enabled =1 ;int gus_enabled =1 ;
@@ -2752,6 +2753,7 @@#if defined(TARGET_PPC ) || defined(TARGET_SPARC ) "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n"#endif +"-nic-pcnet simulate an AMD PC-Net PCI ethernet adaptor\n" "\n" "Network options:\n" "-nics n simulate 'n' network cards [default=1]\n"
@@ -2864,6 +2866,7 @@QEMU_OPTION_L , QEMU_OPTION_no_code_copy, QEMU_OPTION_pci, + QEMU_OPTION_nic_pcnet, QEMU_OPTION_isa, QEMU_OPTION_prep, QEMU_OPTION_k,
@@ -2949,6 +2952,7 @@/* temporary options */ { "pci", 0, QEMU_OPTION_pci }, + { "nic-pcnet", 0, QEMU_OPTION_nic_pcnet }, { "cirrusvga", 0, QEMU_OPTION_cirrusvga }, { NULL }, };
@@ -3314,6 +3318,9 @@break ;case QEMU_OPTION_pci: pci_enabled =1 ; +break ; +case QEMU_OPTION_nic_pcnet: + nic_pcnet =1 ;break ;case QEMU_OPTION_isa: pci_enabled =0 ;
vl.h +6 -0
@@ -628,6 +628,12 @@void isa_ne2000_init (int base,int irq,NetDriverState *nd);void pci_ne2000_init (PCIBus *bus,NetDriverState *nd); +/* pcnet.c */ + +extern int nic_pcnet; + +void pci_pcnet_init (PCIBus *bus,NetDriverState *nd); +/* pckbd.c */ void kbd_init (void );