Solved

m32 flag - segmentation fault

Posted on 2010-08-17
4
355 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
Comment Utility
>> 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
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now