# Segmentation Fault; more info?

**URL:** <https://www.ruby-forum.com/t/segmentation-fault-more-info/195653>\
**Category:** Ruby\
**Created:** [September 27, 2010, 5:49pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653 "2010-09-27T17:49:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 5:49pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/1 "2010-09-27T17:49:02Z")

</div>

I am getting a segmentation fault.

Is there some way to get more information about what caused the fault?

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 5:55pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/2 "2010-09-27T17:55:28Z")

</div>

You’ll have to get a core dump and examine it with gdb. A quick google  
search comes up with this:  
[http://linux-digest.blogspot.com/2008/01/working-with-core-dump.html](http://linux-digest.blogspot.com/2008/01/working-with-core-dump.html)

Jason

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 5:56pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/3 "2010-09-27T17:56:38Z")

</div>

On Sep 27, 12:48 pm, Ralph S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [Note: parts of this message were removed to make it a legal post.]
> 
> I am getting a segmentation fault.
> 
> Is there some way to get more information about what caused the fault?

Along the segmentation fault you should be seen the backtrace of it.

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 8:22pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/4 "2010-09-27T20:22:58Z")

</div>

Luis,

Monday, September 27, 2010, 9:55:13 AM, you wrote:

LL\> On Sep 27, 12:48 pm, Ralph S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > [Note: parts of this message were removed to make it a legal post.]

> > I am getting a segmentation fault.

> > Is there some way to get more information about what caused the fault?

LL\> Along the segmentation fault you should be seen the backtrace of it.

LL\> –  
LL\> Luis L.

I wish I did.

Ralph

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 8:44pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/5 "2010-09-27T20:44:37Z")

</div>

On Sep 27, 2010, at 1:04 PM, Ralph S. wrote:

> > > Is there some way to get more information about what caused the fault?
> 
> LL\> Along the segmentation fault you should be seen the backtrace of it.
> 
> LL\> –  
> LL\> Luis L.
> 
> I wish I did.

You haven’t provided any useful information for us to help you  
(platform, ruby version, code example that causes the crash, etc), but  
I’m going to try again anyway.

If you are running on a UNIX platform with gdb installed, try this:

gdb --args ruby

When gdb starts up, type “run” at the prompt. When it crashes this time  
you might be able to get more information as to location (type ‘bt’ to  
get a backtrace from gdb).

cr

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 9:02pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/6 "2010-09-27T21:02:46Z")

</div>

Chuck,

Monday, September 27, 2010, 12:44:14 PM, you wrote:

CR\> On Sep 27, 2010, at 1:04 PM, Ralph S. wrote:

> > Luis,

> > Monday, September 27, 2010, 9:55:13 AM, you wrote:

> > LL\> On Sep 27, 12:48 pm, Ralph S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > > [Note: parts of this message were removed to make it a legal post.]

> > > > I am getting a segmentation fault.

> > > > Is there some way to get more information about what caused the fault?

> > LL\> Along the segmentation fault you should be seen the backtrace of it.

> > LL\> –  
> > LL\> Luis L.

> > I wish I did.

CR\> You haven’t provided any useful information for us to help you  
(platform, ruby version, code example that causes the crash, etc), but  
I’m going to try again anyway.

CR\> If you are running on a UNIX platform with gdb installed, try this:

CR\> gdb --args ruby

CR\> When gdb starts up, type “run” at the prompt. When it crashes this  
time you might be able to get more information as to location (type ‘bt’  
to get a backtrace from gdb).

CR\> cr

Sorry … Windows Platform.  
[BUG] Segmentation fault  
ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]

The program is an FXRuby program with about 4 threads running. Trimming  
the problem down is not an option.

I was hoping there was some cross-platform general way of getting that  
info.

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 9:15pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/7 "2010-09-27T21:15:39Z")

</div>

On Sep 27, 2010, at 2:08 PM, Chuck R. wrote:

> > CR\> On Sep 27, 2010, at 1:04 PM, Ralph S. wrote:
> > 
> > > > > > I am getting a segmentation fault.  
> > > > > > CR\> You haven’t provided any useful information for us to help you (platform, ruby version, code example that causes the crash, etc), but I’m going to try again anyway.  
> > > > > > [BUG] Segmentation fault  
> > > > > > Check the rubyinstaller wiki for instructions on installing the devkit:
> 
> [Development Kit · oneclick/rubyinstaller Wiki · GitHub](http://github.com/oneclick/rubyinstaller/wiki/Development-Kit)
> 
> I don’t know if it puts gdb into your path or not. Regardless, try to run ruby under gdb like I suggested above and see what happens.

I just checked and it doesn’t look like the devkit install includes gdb.  
☹

So, what I suggested won’t work just by installing devkit. You’ll need  
to download gdb (get a version that matches the gcc version that  
compiled your ruby binary) and compile it yourself.

cr

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 9:08pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/8 "2010-09-27T21:08:37Z")

</div>

On Sep 27, 2010, at 2:02 PM, Ralph S. wrote:

> The program is an FXRuby program with about 4 threads running. Trimming the problem down is not an option.
> 
> I was hoping there was some cross-platform general way of getting that info.

Ah, there might still be a way…

It appears that your ruby was installed from [rubyinstaller.org](http://rubyinstaller.org) which  
means that your ruby was built by gcc. I _think_ that if you install the  
devkit that you might be able to run ruby under gdb on Windows.

Check the rubyinstaller wiki for instructions on installing the devkit:

> **[Development Kit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)**
>
> RubyInstaller for Windows - Build recipes. Contribute to oneclick/rubyinstaller development by creating an account on GitHub.

I don’t know if it puts gdb into your path or not. Regardless, try to  
run ruby under gdb like I suggested above and see what happens.

cr

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [September 27, 2010, 10:20pm UTC](https://www.ruby-forum.com/t/segmentation-fault-more-info/195653/9 "2010-09-27T22:20:38Z")

</div>

On Sep 27, 4:02 pm, Ralph S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Sorry … Windows Platform.  
> [BUG] Segmentation fault  
> ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
> 
> The program is an FXRuby program with about 4 threads running. Trimming the problem down is not an option.
> 
> I was hoping there was some cross-platform general way of getting that info.

Please note that Ruby 1.8.x is not multithread and that the  
interpreter cannot enter in the context from another thread.

Also, there must be a code that raised this segmentation fault, any  
particular function you’re invoking either form C side of FXRuby or in  
Ruby-land.

If you ask the same question on FXRuby group you will get the same  
answers: show some code.

Either to report a bug to Ruby or FXRuby you will need this, so better  
start looking what your code is doing and see what could be the  
culprit.

As for GDB, You can clone RubyInstaller repository and build the  
DevKit yourself to include GDB in it. But don’t expect see in GDB a  
backtrace of the root of your problem, because is not defined if is  
FXRuby or Ruby-land.
