Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6647681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:33:58+00:00 2026-05-26T00:33:58+00:00

I have encountered a wired segmentation fault. I am developing a software in C

  • 0

I have encountered a wired segmentation fault. I am developing a software in C using Eclipse CDT. When running my program on the terminal (Ubuntu 10, 64bits), it simply reports “Segmentation fault”. However, when I debug using gdb in Eclipse, it goes to the end and the result is correct.

I understand that there could be many reasons for segmentation faults. And I am sorry that I am not able to show my code since I do not know where the problem could be…

But could anyone please help me, is there any situation that could happen as my case: segmentation fault on terminals, while fine in debugging? Thanks so much.


Thanks, all. I would spent some time learning valgrind. I just fixed the bug by replacing a malloc() by realloc(). The calling is followed by two memcpy. Is that the reason? Here is the snippet code:

bwa_seq_t *merge_seq (bwa_seq_t *s1, bwa_seq_t *s2) {
  ubyte_t *seq1, *seq2, *tmp;
  if (!s1 || !s2)
    return 0;
  seq1 = s1->seq;
  seq2 = s2->seq;
  tmp = (ubyte_t*) calloc (sizeof(ubyte_t), (s2->len + s1->len + 1));
  memcpy(tmp, seq1, sizeof(ubyte_t) * s1->len);
  memcpy(&tmp[s1->len], seq2, sizeof(ubyte_t) * s2->len);
  s1->len += s2->len;
  tmp[s1->len] = '\0';
  s1->seq = tmp;
  return s1;
}

Could anybody help explain why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:33:59+00:00Added an answer on May 26, 2026 at 12:33 am

    Try the following steps:

    • type ulimit -c unlimited in an xterm (this allows the creation of core/postmorterm files)

    • launch your program (and let it crash): a core file should now be present in the directory.

    • launch the debugger with gdb <yourprogram> <corefile>

    • type bt at gdb prompt to see on what line it did crash.

    • (optional) correct the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have encountered numerous times when a silverlight program is running perfectly, but after
I have encountered a problem in a C program running on an AVR microcontroller
I encountered a wired problem on my C++ code. I'm using TCLAP software to
I have encountered odd behavior when using document.getElementById tonight. Duplicated in Firefox 3 and
I have encountered a problem in my program that has me somewhat stumped. I
I have encountered a problem i cannot find a solution. I am using a
I have encountered a difficulty in understanding the subroutine syntax. using the following code:
I have encountered a unique problem. I am doing a simple ajax call using
I have encountered a slightly bizarre bug while using the ajax control toolkit TabPanel.
I have encountered strange issue with lists in F#. I am using XamlXmlReader to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.