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 illustrates how memory solaris 10 bus error alignment on SPARC systems can bite you if you are doing low-level things solaris bus and coach in C. In the example the program allocates space for a thing structure which will be prepended with a header.
Bus Solaris Sidoarjo
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 id; char data[0];};struct header * maker(
Bus Error (core Dumped) Linux
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 dumped)Annoyingly, if you build a debugging version of this bus error core dumped solaris 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
challenged and removed. (July 2015) (Learn how and when to remove this template message) In computing, a bus error is a fault raised
Bus Error (core Dumped) Centos
by hardware, notifying an operating system (OS) that a process is bus error core dumped c++ trying to access memory that the CPU cannot physically address: an invalid address for the address bus, bus error core dumped in unix hence the name. In modern use on most architectures these are much rarer than segmentation faults, which occur primarily due to memory access violations: problems in the http://blog.jgc.org/2007/04/debugging-solaris-bus-error-caused-by.html logical address or permissions. On POSIX-compliant platforms, bus errors usually result in the SIGBUS signal being sent to the process that caused the error. SIGBUS can also be caused by any general device fault that the computer detects, though a bus error rarely means that the computer hardware is physically broken—it is normally caused by a https://en.wikipedia.org/wiki/Bus_error bug in a program's source code.[citation needed] Bus errors may also be raised for certain other paging errors; see below. Contents 1 Causes 1.1 Non-existent address 1.2 Unaligned access 1.3 Paging errors 2 Example 3 References Causes[edit] There are at least three main causes of bus errors: Non-existent address[edit] Software instructs the CPU to read or write a specific physical memory address. Accordingly, the CPU sets this physical address on its address bus and requests all other hardware connected to the CPU to respond with the results, if they answer for this specific address. If no other hardware responds, the CPU raises an exception, stating that the requested physical address is unrecognized by the whole computer system. Note that this only covers physical memory addresses. Trying to access an undefined virtual memory address is generally considered to be a segmentation fault rather than a bus error, though if the MMU is separate, the processor can't tell the difference. Unaligned access[edit] Most CPUs are byte-addressabl
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more http://stackoverflow.com/questions/6357884/solaris-de-referencing-bus-error about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping https://github.com/numpy/numpy/issues/1433 each other. Join them; it only takes a minute: Sign up Solaris de-referencing bus error up vote 0 down vote favorite I have a function where I'm trying to take a 16-bit from a large chunk of data. bus error I'm running this code on a Solaris box and I can compile without warning or error. When I run this code, however, whenever it gets to the part where I de-deference my pointer, I instantly get a bus error. The code looks something like: void find_info(unsigned char* packet) { int offset = 9; uint16_t short_value = *(uint16_t*)(packet+offset); } The bus error occurs when I'm trying to de-reference that "packet+offset" pointer in order to get a short. I bus error core know for a fact there is data at packet[offset] and packet[offset+1]. On Linux and Cygwin this code works fine. As far as I know, I'm not doing anything revolutionary. What's going on here? pointers casting solaris share|improve this question asked Jun 15 '11 at 12:48 Poff 8429 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote accepted Sounds like an alignment problem. On the Sun SPARC processor, you can only access something like a short via a pointer that is divisible by some power of 2, typically 8. So the value of offset=9 is clearly going to cause a problem. See http://blogs.oracle.com/d/entry/on_misaligned_memory_accesses for more details. I can't recommend any way of fixing this without seeing more context; but if you're reading data from some input source, you could just read the bytes and convert to a short using ntohs (see the man page for ntohs for details). share|improve this answer answered Jun 15 '11 at 13:15 chrisdowney 989617 Very interesting. I'm going to have to experiment more but thanks for leading me the right direction. –Poff Jun 15 '11 at 17:30 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Emai
Support Search GitHub This repository Watch 250 Star 3,405 Fork 1,714 numpy/numpy Code Issues 1,165 Pull requests 149 Projects 0 Wiki Pulse Graphs New issue bus error from numpy self tests on Solaris (Trac #835) #1433 Closed numpy-gitbot opened this Issue Oct 19, 2012 · 4 comments Projects None yet Labels 11 - Bug component: numpy.core priority: high Milestone 1.2.0 Assignees No one assigned 1 participant numpy-gitbot commented Oct 19, 2012 Original ticket http://projects.scipy.org/numpy/ticket/835 on 2008-06-25 by @chanley, assigned to unknown. We have been seeing a bus error on Solaris in the numpy self tests for a couple of days now. The error is occurring with the HEAD of the svn trunk. The message is below: Writing /usr/stsci/pyssgdev/2.5.1/numpy-1.2.0.dev5313-py2.5.egg-info if ( 0 != 0 ) then echo BUILD SUCCEEDED - STARTING TEST BUILD SUCCEEDED - STARTING TEST python /eng/ssb/auto/prog/lib/numpy_test.py /usr/ra/pyssg/2.5.1/numpy/lib/function_base.py:166: FutureWarning: The semantics of histogram will be modified in release 1.2 to improve outlier handling. The new behavior can be obtained using new=True. Note that the new version accepts/returns the bin edges instead of the left bin edges. Please read the docstring for more information. Please read the docstring for more information.""", FutureWarning) /usr/ra/pyssg/2.5.1/numpy/lib/function_base.py:193: FutureWarning: The semantic for bins will change in version 1.2. The bins will become the bin edges, instead of the left bin edges. """, FutureWarning) Bus Error (core dumped) if ( 138 != 0 ) then echo selftest exit 0 A full build log can be found at: http://stsdas.stsci.edu/lore/log/build/grail/numpy/06-24.23.14.log numpy-gitbot closed this Oct 19, 2012 numpy-gitbot commented Oct 23, 2012 @chanley wrote on 2008-06-25 This is probably caused by the same bug as is in ticket #1423. numpy-gitbot commented Oct 23, 2012 @charris wrote on 2008-06-26 I think this is fixed. Can you check and close the ticket if it is? numpy-gitbot commented Oct 23, 2012 @chanley wrote on 2008-06-27 This bu