News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

c::b SIGSEGV

Started by frithjofh, December 02, 2007, 07:53:04 PM

Previous topic - Next topic

frithjofh

hi everybody,

I just got a SIGSEGV on a line I wrote. Checking this with the debugger it said:

cannot acces memory at adress: 0xbaadf00d

I took some time to understand ... could this mean, this adress is "bad food" and will cause an error ...

Not knowing wether this is coded like this on pupose or not at least it gave me a laugh.

greetings from asturias

nausea

ps: is this coded on purpose to spell bad food ?????
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

thomas

0xbaadf00d is a magic constant. What exactly it means depends on your operating system (you did not say which one you use).

On some systems, it is the constant which unallocated memory is initialised to, as such a "funny number" has the property of being so "obviously wrong", that you can immediately see what's wrong, even without a sophisticated debugger.
In that case, it would mean you either deleted a memory block and then used it, or you never allocated it.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

frithjofh

#2
the OS is windows XP, and yes, i found out I din't allocate the memory. a case of one object using another when this does not exist yet...  :?

and yes, it is so obviously wrong that I din't see it ...
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

thomas

Little quote from Wikipedia on that topic:
Quote0xBAADF00D ("bad food") is used by Microsoft's LocalAlloc(LMEM_FIXED) to indicate uninitialised allocated heap memory.
0xBADDCAFE ("bad cafe") is used by 'watchmalloc' in OpenSolaris to mark allocated but uninitialized memory.
0xDEADBEEF ("dead beef") is used by IBM RS/6000 systems, Mac OS on 32-bit PowerPC processors and the Commodore Amiga as a magic debug value. On Sun Microsystems' Solaris, marks freed kernel memory
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

frithjofh

I have looked there allready, it helped me a lot to know where to search the error, but thanks anyway...  :D

Is there any useful list somewhere with those magic numbers in the context of debugging?

greetings from asturias

nausea
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100