HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- SIGBUS immediately after creating C++ object
Operating System - HP-UX
1833770
Members
2084
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
03-05-2002 12:47 PM
03-05-2002 12:47 PM
SIGBUS immediately after creating C++ object
I have run into a problem on 11i (11.11) that seems to have strange behaviors. The code has been working for a long time on NT, Solaris, AIX and HP-UX. I suspect this is a compiler bug, but I wanted to check the forums for help.
I have a C++ class inside of a shared library that is dynamically loaded at run time. When the code is compiled on 10.20, the code runs just fine. When compiled on 11i, it works in some cases, but not others. Here is a snippet of the code:
if (stream == NULL)
{
stream = new CMemoryStream;
THROW_NO_MEMORY(stream, "CPDFFile::StartSave");
}
else
{
stream->Reset();
}
TRACE(qWARNING,("StartSave: Stream has %d bytes\n", stream->GetLength()));
m_pSaveStream = stream;
m_bSaveText = TRUE;
The CMemoryStream looks like this:
class CMemoryStream : public CStream
{
CDynamicArray m_arrBytes;
int m_nSize;
BOOL m_bTextMode;
public:
CMemoryStream(BOOL bTextMode = FALSE);
~CMemoryStream();
int GetLength();
void Reset();
void Write(CStream& strOutput);
void Write(LPCBYTE pData, int len);
int Read(LPCBYTE pData, int max);
};
and the base class looks like this:
// The base class for a stream.
class CStream
{
protected:
long m_nPosition; // The current position in the stream.
public:
CStream();
virtual ~CStream();
virtual long GetPosition();
virtual void GotoPosition(long nPosition);
virtual int GetLength();
virtual void Reset();
virtual void Write(LPCBYTE pData, int len);
virtual int Read(LPCBYTE, int max);
virtual void Flush();
};
Now the problem I have is that the object is not getting constructed properly in those cases where I get the SIGBUS errors. The virtual function table looks like garbage, as well as other members of the CMemoryStream class, and of course, the first attempt to call a virtual function results in the SIGBUS error. Sometimes.
The compiler flags are as follows:
Setting Makefile Macro $VISTAHOME=/vista/garyw/4.4/server
aCC -c +Z -DHPUX_11_00 -DUNIX -DvHPUX -D_HPUX_SOURCE -D_REENTRANT -D_RWSTD_MULTI_THREAD +Z -AA +DA1.1 -D_POSIX_SOURCE -D_XOPEN_SOURCE_EXTENDED +W749,495,67,503 -oHP-UX-B.11.11/PDFFile.o -D_DEBUG -g -DSMARTHEAP -I/opt/SmartHeap/include -I. -I../include -I../../include -I../../winclude -I.. PDFFile.cpp
(cd HP-UX-B.11.11; ld +b.:/lib:/usr/lib -h_Lib -b DllMain.o vpf2html.o VPFFile.o RenditionFile.o HTMLFile.o RTFFile.o PDFFile.o StreamOutput.o StreamFilter.o Report.o ASCIIFile.o XMLFile.o -L/opt/SmartHeap/lib -lsmartheap_smp -lpthread -o libRendition.sl -L../../../../lib/HP-UX-B.11.11 -lServices -lSvcMgr -lttl -lCsup_v2 -lstd_v2; cp libRendition.sl ../../../../lib/HP-UX-B.11.11)
Anyone care to enlighten me on what I may be going wrong?
I have a C++ class inside of a shared library that is dynamically loaded at run time. When the code is compiled on 10.20, the code runs just fine. When compiled on 11i, it works in some cases, but not others. Here is a snippet of the code:
if (stream == NULL)
{
stream = new CMemoryStream;
THROW_NO_MEMORY(stream, "CPDFFile::StartSave");
}
else
{
stream->Reset();
}
TRACE(qWARNING,("StartSave: Stream has %d bytes\n", stream->GetLength()));
m_pSaveStream = stream;
m_bSaveText = TRUE;
The CMemoryStream looks like this:
class CMemoryStream : public CStream
{
CDynamicArray
int m_nSize;
BOOL m_bTextMode;
public:
CMemoryStream(BOOL bTextMode = FALSE);
~CMemoryStream();
int GetLength();
void Reset();
void Write(CStream& strOutput);
void Write(LPCBYTE pData, int len);
int Read(LPCBYTE pData, int max);
};
and the base class looks like this:
// The base class for a stream.
class CStream
{
protected:
long m_nPosition; // The current position in the stream.
public:
CStream();
virtual ~CStream();
virtual long GetPosition();
virtual void GotoPosition(long nPosition);
virtual int GetLength();
virtual void Reset();
virtual void Write(LPCBYTE pData, int len);
virtual int Read(LPCBYTE, int max);
virtual void Flush();
};
Now the problem I have is that the object is not getting constructed properly in those cases where I get the SIGBUS errors. The virtual function table looks like garbage, as well as other members of the CMemoryStream class, and of course, the first attempt to call a virtual function results in the SIGBUS error. Sometimes.
The compiler flags are as follows:
Setting Makefile Macro $VISTAHOME=/vista/garyw/4.4/server
aCC -c +Z -DHPUX_11_00 -DUNIX -DvHPUX -D_HPUX_SOURCE -D_REENTRANT -D_RWSTD_MULTI_THREAD +Z -AA +DA1.1 -D_POSIX_SOURCE -D_XOPEN_SOURCE_EXTENDED +W749,495,67,503 -oHP-UX-B.11.11/PDFFile.o -D_DEBUG -g -DSMARTHEAP -I/opt/SmartHeap/include -I. -I../include -I../../include -I../../winclude -I.. PDFFile.cpp
(cd HP-UX-B.11.11; ld +b.:/lib:/usr/lib -h_Lib -b DllMain.o vpf2html.o VPFFile.o RenditionFile.o HTMLFile.o RTFFile.o PDFFile.o StreamOutput.o StreamFilter.o Report.o ASCIIFile.o XMLFile.o -L/opt/SmartHeap/lib -lsmartheap_smp -lpthread -o libRendition.sl -L../../../../lib/HP-UX-B.11.11 -lServices -lSvcMgr -lttl -lCsup_v2 -lstd_v2; cp libRendition.sl ../../../../lib/HP-UX-B.11.11)
Anyone care to enlighten me on what I may be going wrong?
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 12:40 PM
03-06-2002 12:40 PM
Re: SIGBUS immediately after creating C++ object
Found the problem. Someone left out the -Bsymbolic flag from the linker options.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP