- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Segmentation fault address not mapped to object er...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-04-2009 06:56 AM
тАО06-04-2009 06:56 AM
have developed a class to read config file (flat file with space as a field seperator ) on plattform HP-UX B.11.23 IA 64 .
I am passing char arrays to a function which reads the config file and traverse line by line and retrieves value on the basis of key passed as parameter . I am getting above error .when i call this function more than once. First time call works fine but second time it fails with above error.
please see code for function
int CConfigReader::GetConfigValue(char *paramApp,int paramKey,char *ResultValue)
{
ifstream Stream (szConfigPath);
if (Stream.is_open())
{
while(!Stream.eof())
{
string buffer=NULL;
getline(Stream, buffer);
if(buffer.length() !=0)
{
if (buffer.find('#') == string::npos)
{
//ingnore the line header
string *pstrSplit=NULL;
int iNumWords =split(buffer, pstrSplit);
if(iNumWords != -1)
{
if (pstrSplit[0].compare(paramApp)!=0)
{
continue;
}
else
{
printf("Line read is %s \n",buffer);
printf("Result is %s \n",pstrSplit[paramKey]);
strcpy(ResultValue,pstrSplit[paramKey].c_str());
break;
}
}
else
{
cout << "Error in reading the line "<
}
}
else
{
cout << "header line ignore it "<
}
}
else
{
cout << "empty line ignore it "<
}//end of while
}
else
{
cout << "unable to open the stream ";
return 1;
}
Stream.close();
return 0;
}
Please help me to sort out this error .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-04-2009 08:02 PM
тАО06-04-2009 08:02 PM
Re: Segmentation fault address not mapped to object error
Is ResultValue big enough?
>but second time it fails with above error.
Do you have a stack trace? Have you compiled with -g to debug it?
>string buffer=NULL;
No need to use "=NULL". string has a default constructor.
>printf("Line read is %s \n",buffer);
This should be:
printf("Line read is %s\n", buffer.c_str());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2009 02:48 AM
тАО06-05-2009 02:48 AM
Re: Segmentation fault address not mapped to object error
PLease find follwing details
1)Is ResultValue big enough?
I am calling this function as below :
[code]
char szLogDir[256 ];///global variable
//or char szLogDir[MAX_PATH];
enum AppConfig {AppName=0,Server,Port,LogDir};
AppConfig enLogDir=LogDir;
CConfigReader config=CConfigReader(szConfigFile);
if (!config.GetConfigValue"SETTINGS",enLogDir,szLogDir))
{
printf("Log Directory read from config file successfully \n");
}
else
{
printf("Error in reading the config file while reading Log directory \n" );
exit ;
}
[\code]
The trget array has size 256 and source size is 20 .
2) Yeah I have compiled this code with -g and i get following message/error
si_code: 1 - SEGV_MAPERR - Address not mapped to object.
0x9fffffffbf544560:0 in pthread_mutex_destroy+0xc0 ()
from /usr/lib/hpux64/libpthread.so.1
Please let me know if you need any more input .
Thanks in advance .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2009 04:36 AM
тАО06-05-2009 04:36 AM
Re: Segmentation fault address not mapped to object error
si_code: 1 - SEGV_MAPERR - Address not mapped to object.
0x9fffffffbf544560:0 in pthread_mutex_destroy+0xc0 libpthread.so.1
>Please let me know if you need any more input.
The rest of the whole stack trace.
Have you compiled everything with -mt?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2009 06:38 AM
тАО06-05-2009 06:38 AM
Re: Segmentation fault address not mapped to object error
Thanks you very much ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2009 06:01 PM
тАО06-05-2009 06:01 PM
SolutionIf you are happy with your answers, please read the following about assigning points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33