There are two cases where my code won't seg fault:
When I use Smart::Comments in at least one place
run through the debugger.
I've tracked it down to this call:
$action->{breakdown}
= join( ' '
, each_pair {
my ( $name, $length ) = @_;
return "x$length" if $name eq 'FILLER';
...
I have a shared library (namely libXXX.so) with a cpp/h file associated.
They contains a number of function pointers ( to point to .so function entrypoint) and a class to wrap this functions as methods of the said class.
ie: .h file:
typedef void* handle;
/* wrapper functions */
handle okUsbFrontPanel_Construct();
void okUsbFrontPanel_...
On running the following script, I get segmentation fault. The output consists of "here 5a". But nothing beyond it. Any suggestions on what might be going wrong?
if(model==1)
fptr3=fopen("poisson.pro","r");
if(model==2)
fptr3=fopen("jtt.pro","r");
if(model==3)
fptr3=fopen("estimate.pro","r");
printf ("here 5a\n");
for (i=0;i<20...
I'm clearly missing something. Could someone please explain why this would happen?
#define RANDOM_DEVICE "/dev/random"
int create_shared_secret(char * secret,int size)
{
FILE * file=NULL;
int RetVal;
file=fopen(RANDOM_DEVICE,"r");
if(!file)
{
printf("Unable to open random device %s\n",RANDOM_DEVICE);
exit(-1);
}
R...
In C++, I know that the compiler can choose to initialize static objects in any order that it chooses (subject to a few constraints), and that in general you cannot choose or determine the static initialization order.
However, once a program has been compiled, the compiler has to have made a decision about what order to initialize these...
EDIT: Problem solved. This was (yet another) situation where the problem wasn't really where it looked like it was. The clue was the use of @0xfeeefefe as a pointer to an object. This is an address that is returned by a windows API function when freeing memory... indicating that the object that was being operated on had been deleted.
I'...
I have a Ruby script, which uses one external lib.
Sometimes script exits with segmentation fault,
when uses this lib and I must to rerun it.
Is it possible to somehow rescue this error by extracting fragment,
which has dangerous code to separate process or something like that?
Thanks
...
I'm new to C++ and I haven't a clue where to start, so I uploaded the code to a pastebin because there is a lot of it.
This code compiles fine, and doesn't give off a warning, even with gcc's -Wall option.
It's supposed to generate all prime numbers up to a number given as a command line parameter.
On smaller numbers (e.g. 4,000 or 5,...
I'm trying to make a program that will prompt the user for a command, then use exec to execute that command.
For instance if they gave me "ls -la" I would have to execute that command. I've tried the following code:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
int main()
{
int ret, num_args;
printf("Enter numbe...
Hi, I'm stuck at a Segmentation fault after inserting about 8 million records in a TC Hash Database. After everything is inserted I close the DB but I caught a Segmentation Fault at this part of the code (tchdb.c):
static void tchdbsetflag(TCHDB *hdb, int flag, bool sign){
assert(hdb);
char *fp = (char *)hdb->map + HDBFLAGSOFF;
if...
I've gotten a crash in my program which seems fine to me, of course my program says otherwise, which confuses me.
This snippet of my function I am currently working on:
for(int k = 0; k < dictionary[k].size(); k++)
{
//"i" represents the fragment's first character
//while "k" represents the dicti...
Hi,
The following code summarizes the problem I have at the moment. My current execution flow is as follows and a I'm running in GCC 4.3.
jmp_buf a_buf;
jmp_buf b_buf;
void b_helper()
{
printf("entering b_helper");
if(setjmp(b_buf) == 0)
{
printf("longjmping to a_buf");
longjmp(a_buf, 1);
}
printf("return...
I am trying to debug a segfault, and I have this output from gdb:
(gdb) n
Program received signal SIGSEGV, Segmentation fault.
0x08048af9 in parse_option_list (ptr=0x6f72505f <Address 0x6f72505f out of bounds>, box_name=0x696d6978 <Address 0x696d6978 out of bounds>, option_list=0x313a7974,
num_elements=0x33313532) at submit.c:125
...
Hi, my code segfaults and I don't know why.
1 #include <stdio.h>
2
3 void overwrite(char str[], char x) {
4 int i;
5 for (i = 0; str[i] != '\0'; i++)
6 str[i] = x;
7 }
8
9 int main(void) {
10 char *s = "abcde";
11 char x = 'X';
12 overwrite(s, x);
13 printf("%s\n", s);
14 return 0;
15 }
The gdb ...
I need to read the input from the console and put it into an array of chars. I wrote the following code, but I get the following error: "Segmentation Fault"
#include <stdio.h>
#include <stdlib.h>
int main() {
char c;
int count;
char arr[50];
c = getchar();
count = 0;
while(c != EOF){
arr[count] = c;
...
(My environment is 64-bit Ubuntu, my application is C++ compiled and linked with g++.)
When an application does something like divide by zero or run a asm("int $3") left in the code, one of the following gets logged via syslog to /var/log/kern.log and /var/log/messages:
Sep 10 18:06:47 VM kernel: [117194.123452] a.out[20288] trap divid...
The situation:
I have a std::vector that contains strings at specific offsets. Here's a shortened dump:
...
@128 00 00 00 00 00 00 00 00 73 6F 6D 65 74 68 69 33 ........somethin
@144 38 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ng..............
@160 00 00 00 00 00 00 00 00 31 2E 32 2E 33 00 00 00 ........1.2.3...
@176 00...
I have a tab-delimited text file that I am parsing. Its first column contains strings of the format chrX, where X denotes a set of strings, e.g., "1", "2", ..., "X", "Y".
These are each stored in a char* called chromosome, as the file is parsed.
The text file is sorted on the first column lexicographically, i.e., I will have a number...
I have some complicated C++ code but the problem narrows down to doing a push_back on a list of structures:
list<cache_page> cachedPages;
void f()
{
cache_page cpage(a,b);
cachedPages.push_back(cpage);
}
I have commented all the data members of the struct cache_page and still the error persists. If I comment the push_back lin...
When my linux application crashes, it produces a line in the logs something like:
segfault at 0000000 rip 00003f32a823 rsp 000123ade323 error 4
What are those rip and rsp addresses? how do I use them to pinpoint the problem? do they correspond to something in the "objdump" or "readelf" outputs? are they useful if my program gets its sy...