Solved

m32 flag - segmentation fault

Posted on 2010-08-17
4
365 Views
Last Modified: 2012-05-10
hi,

i am running my code on a 64 bit machine and it works fine. But, when I put m32 flag, after a while, i get segmentation faults...what could the problem be..anything is appreciated..thanks
0
Comment
Question by:zizi21
  • 2
4 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 33461690
>> anything is appreciated..

That's precisely what could be the problem : anything :)

Without seeing the code, and without information about where and under which circumstances the segmentation fault occurs, there's not much to say, except guess.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 33462634
Time to work on your post-mortem debugging skills (trust me it's a bit of a learning curve but it is one you really will get a great deal of payback from in the future!)...

Have you tried using your debugger to analyse the core file?

You'll need to set ulimit to allow the core to be created if you don't currently get one, setting it to unlimited is the easiest thing.

ulimit -c unlimited]

http://aplawrence.com/Linux/limit_core_files.html
http://linux.die.net/man/1/ulimit

Also, if you've not already done so you'll need to build with symbols (assuming gcc you add the -g flag).

Using GDB is pretty simple (I presume this will be the debugger you use). Open the core file using the debugger.

gdb -c

Then use the backtrace (bt) command to look at the callstack. You can then analyse different stack frames are you see fit.

Some links that looked like they might be useful:
http://linux.bytesex.org/gdb.html
http://www.network-theory.co.uk/articles/gccdebug.html
http://www.freebsd.org/doc/en/books/developers-handbook/debugging.html
http://www.yolinux.com/TUTORIALS/GDB-Commands.html
http://www.delorie.com/gnu/docs/gdb/gdb_8.html
http://cs.baylor.edu/~donahoo/tools/gdb/tutorial.html
0
 

Author Comment

by:zizi21
ID: 33462921
can i confirm something..if a server has a physical ram 4 gb, when m32 flag, is used, how much of memory can the program used..it is just that previously the machine was 32 bit and with top, you get 3 gb of memory and now, the operating system is reinstalled too 64 bit and the memory with top is 4 gb. my guess is that with m32 flag, you can't use 4 gb of ram but less . this is because i had a program that use 2 gb plus ram and it is fine...only when it is more than 3gb, it gets seg fault...

my question is if you use m32 flag, is there a limitation of the ram that you can use...has it been set somewhere..apologize for not explaining this earlier..
0
 
LVL 40

Accepted Solution

by:
evilrix earned 500 total points
ID: 33463006
>> my question is if you use m32 flag, is there a limitation of the ram that you can use

Since the address space becomes 32 bit the maximum memory a 32 bit process can possible address is 4GB. That said, in reality the amount of user memory is a lot less (usually 1 or 2 GB) since the rest is reserve in the processes memory map for various other reasons (such as for use my the kernel to map devices - this is probably a poor example).
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question