Gdb Bus Error Solaris
Contents |
I'm not pointing my finger at gcc here, this is a Sun gotcha).Here's an example program (simplified for something much more complex that I was debugging), that
Bus Error C++
illustrates how memory alignment on SPARC systems can bite you if you are bus error (core dumped) linux doing low-level things in C. In the example the program allocates space for a thing structure which will be
Bus Error Linux
prepended with a header. The header structure has a dummy byte array called data which will be used to reference the start of the thing.struct thing { int an_int;};struct header { short how to debug bus error id; char data[0];};struct header * maker( int size ) { return (struct header *)malloc( sizeof( struct header ) + size );}int main( void ) { struct header * a_headered_thing = maker( sizeof( struct thing ) ); struct thing * a_thing = (struct thing *)&(a_headered_thing->data[0]); a_thing->an_int = 42;}If you build this on a SPARC machine you'll get the following error when you run it:Bus Error (core how to solve bus error in linux dumped)Annoyingly, if you build a debugging version of this program the problem magically goes away and doesn't dump core in the debugger. So you either resort to printf-style debugging or going into gdb and looking at the assembly output.Here's what happens when you run this in gdb (non-debug code):(gdb) runProgram received signal SIGSEGV, Segmentation fault.0x000106d8 in main ()Since you can't get back to the source we're forced to do a little disassembly:(gdb) disassembleDump of assembler code for function main:0x000106b0
has received a signal indicating that it attempted to
Bus Error 10 Mac
perform I/O to a device that is restricted or that does not exist. http://blog.jgc.org/2007/04/debugging-solaris-bus-error-caused-by.html This message is usually accompanied by a core dump, except on read-only file systems. Action Use a debugger to examine the core file and determine what program https://docs.oracle.com/cd/E19455-01/806-1075/msgs-1097/index.html fault or system problem led to the bus error. If possible, check the program's output files for data corruption that might have occurred before the bus error. Technical Notes Bus errors can result from either a programming error or device corruption on your system. Some common causes of bus errors are: invalid file descriptors, unreasonable I/O requests, bad memory allocation, misaligned data structures, compiler bugs, and corrupt boot blocks. Previous: Broken pipeNext: "C" © 2010, Oracle Corporation and/or its affiliates
Sign in Pricing Blog Support Search GitHub This repository Watch 62 Star 415 Fork 265 the-tcpdump-group/tcpdump Code Issues 44 Pull requests 11 Projects https://github.com/the-tcpdump-group/tcpdump/issues/131 0 Pulse Graphs New issue tcpdump 4.1.1 bus error when 'gcc -O2' on Solaris 10 SPARC #131 Closed guyharris opened this Issue Apr 16, 2013 · 1 comment Projects None https://ask.wireshark.org/questions/7742/solaris-10-tshark-bus-error-when-reading-some-pcap-files yet Labels duplicate found in 4.1 Milestone No milestone Assignees No one assigned 1 participant The Tcpdump Group member guyharris commented Apr 16, 2013 Converted from bus error SourceForge issue 3056372, submitted by itillman tcpdump 4.1.1 bus error when 'gcc -O2' on Solaris 10 SPARC Platform: tcpdump 4.1.1 libpcap 1.1.1 Solaris 10 on SPARC gcc 4.2.4 Perhaps this is another instance of issue #130 (the crash is due to something that gets optimized away on the Solaris SPARC platform). tcpdump 4.1.1 built with 'gcc -O2' (the default): gdb bus error % /var/local/src/tcpdump-4.1.1+PU-3/tcpdump -ne -r crash1.pcap reading from file crash1.pcap, link-type EN10MB (Ethernet) Bus Error (core dumped) Adding '-q' makes the crash go away: % /var/local/src/tcpdump-4.1.1+PU-3/tcpdump -neq -r /usr/tmp/crash1.pcap reading from file /usr/tmp/crash1.pcap, link-type EN10MB (Ethernet) 19:44:08.467355 00:13:c4:64:e8:c0 > 00:09:12:2d:d1:80, IPv4, length 234: 64.19.169.242.500 > 140.180.168.77.500: UDP, length 192 If built instead without '-O2' this makes problem go away: % /usr/local/etc/tcpdump-4.1.1+PU-3-noopt -ne -r crash1.pcap reading from file crash1.pcap, link-type EN10MB (Ethernet) 19:44:08.467355 00:13:c4:64:e8:c0 > 00:09:12:2d:d1:80, ethertype IPv4 (0x0800), length 234: 64.19.169.242.500 > 140.180.168.77.500: isakmp: phase 1 I ident Rebuilt tcpdump adding '-g' to CCOPT in Makefile (retaining the '-O2'), so we can debug more easily. Crashes as above. Looking at the resulting core: % gdb /var/local/src/tcpdump-4.1.1+PU-3/tcpdump /usr/tmp/core.tcpdump.621.9939 GNU gdb (GDB) 7.0 Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
how to fix it? (ie. Do it need to recompile tshark or just have the dependence updated?) The version of tshark and its dependency are from the sunfreeware.com. # uname -a SunOS daisy 5.10 Generic_127127-11 sun4u sparc SUNW,Sun-Blade-1500 Solaris # # tshark -r dhcp.pcap ... 229 159.632917 MasterIn_16:74:3c -> Broadcast ARP 68 Who has 192.168.150.150? Tell 192.168.150.192 230 160.003917 Cisco_51:01:db -> Spanning-tree-(for-bridges)_00 STP 64 RST. Root = 8192/152/00:11:bc:c3:94:00 Cost = 4 Port = 0x80cc Bus Error (core dumped) gdb indicate there is a Illegal instruction in the libcrypto.so.1.0.0 #0 0xfd4be44c in ?? () from /usr/local/lib/libwireshark.so.1 (gdb) r Starting program: /usr/local/bin/tshark [New LWP 1 ] warning: Lowest section in /usr/lib/libpthread.so.1 is .dynamic at 00000074 warning: Lowest section in /usr/lib/libthread.so.1 is .dynamic at 00000074 warning: Lowest section in /lib/libdl.so.1 is .hash at 000000b4 Program received signal SIGILL, Illegal instruction. 0xfc0cbd3c in _sparcv9_fmadd_probe () from /usr/local/ssl/lib/libcrypto.so.1.0.0 (gdb) # tshark -v TShark 1.6.4 (SVN Rev Unknown from unknown) Copyright 1998-2011 Gerald Combs <[emailprotected]> and contributors. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURP