# Segmentation Fault; more info?

**URL:** <https://rubytalk.org/t/segmentation-fault-more-info/60221>\
**Category:** ruby-talk\
**Created:** [27 September 2010 15:48 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221 "2010-09-27T15:48:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ralph\_Shnelvar](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Ralph\_Shnelvar](https://rubytalk.org/u/Ralph_Shnelvar)\
**Post date:** [27 September 2010 15:48 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/1 "2010-09-27T15:48:19Z")

</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:** ![Jason\_Stewart](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jason\_Stewart](https://rubytalk.org/u/Jason_Stewart)\
**Post date:** [27 September 2010 15:54 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/2 "2010-09-27T15:54:57Z")

</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

> **···**
>
> On Mon, Sep 27, 2010 at 11:48 AM, Ralph Shnelvar \<ralphs@dos32.com\> wrote:
> 
> > I am getting a segmentation fault.
> > 
> > Is there some way to get more information about what caused the fault?

---

<div class="post-metadata">

**Author:** ![Luis\_Lavena1](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@Luis\_Lavena1](https://rubytalk.org/u/Luis_Lavena1)\
**Post date:** [27 September 2010 15:55 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/3 "2010-09-27T15:55:13Z")

</div>

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

> **···**
>
> On Sep 27, 12:48 pm, Ralph Shnelvar \<ral...@dos32.com\> 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?
> 
> --  
> Luis Lavena

---

<div class="post-metadata">

**Author:** ![Ralph\_Shnelvar](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Ralph\_Shnelvar](https://rubytalk.org/u/Ralph_Shnelvar)\
**Post date:** [27 September 2010 18:04 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/4 "2010-09-27T18:04:24Z")

</div>

Luis,

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

> **···**
>
> > On Sep 27, 12:48 pm, Ralph Shnelvar \<ral...@dos32.com\> 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.
> 
> > --  
> > Luis Lavena
> 
> I wish I did.
> 
> Ralph

---

<div class="post-metadata">

**Author:** ![Chuck\_Remes](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@Chuck\_Remes](https://rubytalk.org/u/Chuck_Remes)\
**Post date:** [27 September 2010 18:44 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/5 "2010-09-27T18:44:14Z")

</div>

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 \<script name\>

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

> **···**
>
> On Sep 27, 2010, at 1:04 PM, Ralph Shnelvar wrote:
> 
> > Luis,
> > 
> > Monday, September 27, 2010, 9:55:13 AM, you wrote:
> > 
> > \> On Sep 27, 12:48 pm, Ralph Shnelvar \<ral...@dos32.com\> 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.
> > 
> > \> --  
> > \> Luis Lavena
> > 
> > I wish I did.

---

<div class="post-metadata">

**Author:** ![Ralph\_Shnelvar](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Ralph\_Shnelvar](https://rubytalk.org/u/Ralph_Shnelvar)\
**Post date:** [27 September 2010 19:02 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/6 "2010-09-27T19:02:22Z")

</div>

Chuck,

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

> **···**
>
> > On Sep 27, 2010, at 1:04 PM, Ralph Shnelvar wrote:
> 
> > > Luis,
> 
> > > Monday, September 27, 2010, 9:55:13 AM, you wrote:
> 
> > > \> On Sep 27, 12:48 pm, Ralph Shnelvar \<ral...@dos32.com\> 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.
> 
> > > \> --  
> > > \> Luis Lavena
> 
> > > 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 \<script name\>
> 
> > 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
> 
> 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:** ![Chuck\_Remes](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@Chuck\_Remes](https://rubytalk.org/u/Chuck_Remes)\
**Post date:** [27 September 2010 19:08 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/7 "2010-09-27T19:08:09Z")

</div>

Ah, there might still be a way...

It appears that your ruby was installed from 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

> **···**
>
> On Sep 27, 2010, at 2:02 PM, Ralph Shnelvar wrote:
> 
> > Chuck,
> > 
> > Monday, September 27, 2010, 12:44:14 PM, you wrote:
> > 
> > \> On Sep 27, 2010, at 1:04 PM, Ralph Shnelvar wrote:
> > 
> > > > Luis,
> > 
> > > > Monday, September 27, 2010, 9:55:13 AM, you wrote:
> > 
> > > > \> On Sep 27, 12:48 pm, Ralph Shnelvar \<ral...@dos32.com\> 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.
> > 
> > > > \> --  
> > > > \> Luis Lavena
> > 
> > > > 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 \<script name\>
> > 
> > \> 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
> > 
> > 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:** ![Luis\_Lavena1](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@Luis\_Lavena1](https://rubytalk.org/u/Luis_Lavena1)\
**Post date:** [27 September 2010 20:20 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/8 "2010-09-27T20:20:09Z")

</div>

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.

> **···**
>
> On Sep 27, 4:02 pm, Ralph Shnelvar \<ral...@dos32.com\> 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.
> 
> --  
> Luis Lavena

---

<div class="post-metadata">

**Author:** ![Chuck\_Remes](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@Chuck\_Remes](https://rubytalk.org/u/Chuck_Remes)\
**Post date:** [27 September 2010 19:14 UTC](https://rubytalk.org/t/segmentation-fault-more-info/60221/9 "2010-09-27T19:14:49Z")

</div>

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

> **···**
>
> On Sep 27, 2010, at 2:08 PM, Chuck Remes wrote:
> 
> > On Sep 27, 2010, at 2:02 PM, Ralph Shnelvar wrote:
> > 
> > > Chuck,
> > > 
> > > Monday, September 27, 2010, 12:44:14 PM, you wrote:
> > > 
> > > \> On Sep 27, 2010, at 1:04 PM, Ralph Shnelvar wrote:
> > > 
> > > > > Luis,
> > > 
> > > > > Monday, September 27, 2010, 9:55:13 AM, you wrote:
> > > 
> > > > > \> On Sep 27, 12:48 pm, Ralph Shnelvar \<ral...@dos32.com\> 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.
> > > 
> > > > > \> --  
> > > > > \> Luis Lavena
> > > 
> > > > > 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 \<script name\>
> > > 
> > > \> 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
> > > 
> > > 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.
> > 
> > Ah, there might still be a way...
> > 
> > It appears that your ruby was installed from 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 · 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.
