The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can't locate object method "fetchrow_array" Error rawat_me01 Shell Programming and Scripting 1 06-03-2009 10:07 AM
Help! "Bus error" and "CPU Panic" box wont boot hcclnoodles SUN Solaris 3 10-05-2006 04:38 PM
shared object "undefined symbol: fstat" error marcus121 High Level Programming 5 04-24-2006 07:11 PM
dbx error ("Executable contains object file compiled on ...") Sabari Nath S High Level Programming 0 08-04-2005 05:03 PM
Error : "No data written to object that was write locked" nileshkarania UNIX for Dummies Questions & Answers 1 06-07-2003 11:29 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-13-2008
dona_m dona_m is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 6
getting "mi_cmd_var_create: unable to create variable object" error msg

Hi,
i am working in C in Fedora Eclipse 3.3.0 with gdb debugger. I am geting segmentation fault with an error message "mi_cmd_var_create: unable to create variable object" on debugging the program.

What should I do to solve this problem?

rgds,
Dona_m
  #2 (permalink)  
Old 08-13-2008
shamrock shamrock is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2007
Location: USA
Posts: 750
Question Local or Global variable

Is this variable local to a function or is it global. If global check the allocated data segment size else check the allocated stack segment. Try increasing the size of whichever segment it lies in.
  #3 (permalink)  
Old 08-14-2008
dona_m dona_m is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 6
I tried by increasing the stack size.But it is not working . It is actually stopped due to segmentation fault with a debugger message "suspended: signal 'SIGSEGV' received".
  #4 (permalink)  
Old 08-14-2008
dona_m dona_m is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 6
It is declared as global variable. Is it due to some register related problem?
  #5 (permalink)  
Old 08-14-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
It would help a lot if we could see the code. Does the code compile with no errors and no warnings? .. global variables are not allocated on the stack.
  #6 (permalink)  
Old 08-14-2008
dona_m dona_m is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 6
It compile with no errors and no warnings.This is the part of code

#include<stdio.h>
#include<string.h>
#include "header.h"
#include "struct.h"

extern struct stack_rec stack[100];
extern char word[MAXWORD], mal_mean[MAXWORD], E_attr[MAXLEN], H_attr[CATLEN], semantic_tag[MAXWORD];
extern int word_cat, top, VOICE, prep_par, pos, phrase;

void getreltvform (char[], int);
void check_suffix (char[], int , int);
int p = 0;

/***This function is used to resolve the meaning of relative pronouns and takes the formation with the word***/

void resolve_reltvpronoun ()
{
char mmean[MAXWORD], means[5][MAXWORD];
int len = 0, i, clen = 0, ci = 0, spos = 0;

p = pos;
printf ("\ninside resolve rel pronouunnn\n");
if (stack[top - 1].word_cat == KARAK && prep_par == 7)
spos = top - 2;
else
spos = top - 1;

strcpy (mmean, stack[spos].mal);

len = strlen (mmean);
printf ("\n\nstack mal : %s\n", mmean);

stack[spos].mal[0] = '\0';

for (; i < 5; i++)
means[i][0] = '\0';

for (i = 0; mmean[i] != '\0'; i++)
{
if (mmean[i] == '/')
{
means[clen++][ci] = '\0';
ci = 0;
}
else
means[clen][ci++] = mmean[i];
}
means[clen][ci] = '\0';

for (i = 0; i <= clen; i++)
getreltvform (means[i], spos);

stack[spos].mal[strlen (stack[spos].mal) - 1] = '\0';
printf ("\n final stack mallllllllll : %s", stack[spos].mal);
}

segmention fault occur at the line -stack[spos].mal[0] = '\0';If we comment the line it will go to another line after that.
All the extern variables are declared in other files.
  #7 (permalink)  
Old 08-14-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Sounds like spos is going out of bounds. Can you print out its value just before? How large is stack[] and how is it defined?

Last edited by era; 08-14-2008 at 06:56 AM.. Reason: Hey, a fellow computational linguist! http://xkcd.com/114/
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0