Re: Segfault in _this()
- From: Johan Cronje <jcronje dsp sun ac za>
- To: Bowie Owens <bowie owens csiro au>
- Cc: orbitcpp-list gnome org
- Subject: Re: Segfault in _this()
- Date: Mon, 4 Aug 2003 15:11:09 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Friday 01 August 2003 01:47, Bowie Owens wrote:
> Hi Johan,
>
> As for where to look, please try and determine which memory reference
> caused the seg. fault. Was the rootPOA pointer null? Was the method
> invoked on a null pointer (null this pointer)? Was the object the method
> was invoked on deleted prior to the method call? Was the seg. fault
> inside one the calls to activate_object or servant_to_id?
>
This is the new generated _this() method that 1.3.6 gives me (-cpp-skels.cpp
file). I have added the cout statements for debugging purposes.
1 ::sdr_corba::sdr_subcontroller_ptr POA_sdr_corba::sdr_subcontroller::_this()
2 {
3 cout << "blah\n";
4 PortableServer::POA_var rootPOA = _default_POA ();
5 cout << "blah 1\n";
6 CORBA::Object_var object = rootPOA->servant_to_reference (this);
7 cout << "blah 2\n";
8 return ::_orbitcpp::stub::sdr_corba::sdr_subcontroller::_orbitcpp_wrap
9 (object->_orbitcpp_cobj (), true);
10 }
Now, the program segfaults between blah1 and blah2, indicating an error in
line 6. The output of gdb is as follows:
(gdb) run
Starting program: /home/jcronje/SDR/devel/corbasdr/sdr_corba
[New Thread 16384 (LWP 29450)]
ORB_init
orb->resolve_initial_references
_narrow
rootPOA->the_POAManager
mgr->activate
POA_sdr_corba_sdr_subcontroller__init (Called by
::POA_sdr_corba::sdr_subcontroller::sdr_subcontroller)
servant created
Test Class
blah
blah 1
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 29450)]
0x4006d346 in ORBit_POA_activate_object () from /usr/lib/libORBit-2.so.0
Does this mean that my rootPOA pointer is null? If so, how do I fix it?
Also find attached my main server implementation file, sdr_corba.cpp.
Any help or direction will be greatly appreciated.
Thank you
Johan
- --
- ---------------------------------------------------------------
"There is beauty in simplicity" -- Johan Cronje
- ---------------------------------------------------------------
Johan Cronje
Digital Signal Processing / Telecommunications Group
Electrical and Electronic Engineering Department
University of Stellenbosch
http://www.dsp.sun.ac.za/~jcronje
GNUPG Key: http://www.dsp.sun.ac.za/~jcronje/jcronje.asc
- ---------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iQEVAwUBPy5bcOEeclgONaRbAQLXJAf7BuLHe/DzL4XA88J/xb6SfMq0GJ8GLr5z
up//bIK6XapR/3e+Ba1sJfkZ0ccTOre06LZcy4f11vNk9ojAYbvO6V73fWpqLwBy
uHrCYBl0IFj295DcosxVxJi+33ecVGWsIQHTDLDThSyijCZhOIer3s/aDAcqDiZj
RSvMuwA5XpfgAeznwW8RhGjDrzleGE2IJJAmFaKYpEJ+niEJgV7ubHBxlk6EfMii
aPwZq5InfVIzI2TNsFjImkc4VNvX6w6X0ndrPitq7/vGiN6g9fTviJhWvroHmXEn
e1jPIs34F0SAp4AVe6ao03OeE99kHrnJSnZwyQezQ3zSAWrGd937ZQ==
=K2zX
-----END PGP SIGNATURE-----
/** $Id$
* @file sdr_corba.cpp
* @brief SDR CORBA ORBit Implementation
* @author Johan Cronjé
* @date 29/05/2003 14:53
*/
#include <string>
#include "sdr_corba.h"
#include "sdr_corba-cpp.h"
#include "sdr_corba_impl.h"
#include <iostream>
#include <linc/linc.h>
using namespace std;
using namespace POA_sdr_corba;
using namespace _orbitcpp;
using namespace sdr_corba;
//using namespace sdr_base_classes;
void POA_sdr_corba_sdr_subcontroller__init(PortableServer_Servant servant,
CORBA_Environment * ev)
{
cout << "POA_sdr_corba_sdr_subcontroller__init" <<
" (Called by ::POA_sdr_corba::sdr_subcontroller::sdr_subcontroller)\n";
}
void POA_sdr_corba_sdr_subcontroller__fini(PortableServer_Servant servant,
CORBA_Environment * ev)
{
cout << "Sukkel jy lekker? fini\n";
}
sdr_corba_attributes_list*
sdr_corba_sdr_subcontroller_return_attributes(sdr_corba_sdr_subcontroller _obj,
CORBA_Environment * ev)
{
cout << "Sukkel jy lekker? 34 - 39\n";
}
CORBA_float
sdr_corba_sdr_subcontroller_return_attribute_value(sdr_corba_sdr_subcontroller _obj,
const CORBA_char * attrib_c,
CORBA_Environment * ev)
{
cout << "Sukkel jy lekker? 41-47\n";
}
void sdr_corba_sdr_subcontroller_change_attribute_value(sdr_corba_sdr_subcontroller _obj,
const CORBA_char * attribute_name,
const CORBA_char * attribute_value,
CORBA_Environment * ev)
{
cout << "Sukkel jy lekker? 49-55\n";
}
sdr_corba_component_name
sdr_corba_sdr_subcontroller_return_component_name(sdr_corba_sdr_subcontroller _obj,
CORBA_Environment* ev)
{
cout << "Sukkel jy lekker? 57-62\n";
}
int main (int argc, char* argv[])
{
// Initialize the CORBA orb
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
cout << "ORB_init\n";
// Get the root POA
CORBA::Object_var pfobj = orb->resolve_initial_references("RootPOA");
cout << "orb->resolve_initial_references\n";
PortableServer::POA_var rootPOA =
PortableServer::POA::_narrow(pfobj);
cout << "_narrow\n";
// Activate the root POA's manager
PortableServer::POAManager_var mgr = rootPOA->the_POAManager();
cout << "rootPOA->the_POAManager\n";
mgr->activate();
cout << "mgr->activate\n";
// Create a Servant and explicitly create a CORBA object
sdr_corba::sdr_corba_impl servant;
cout << "servant created\n";
cout << servant.return_component_name() << endl;
CORBA::Object_var object = servant._this();
cout << "object = servant._this\n";
// Here we get the IOR for the Hello server object.
// Our "client" will use the IOR to find the object to connect to
CORBA::String_var ref = orb->object_to_string( object );
// print out the IOR
cout << ref << endl;
// run the server event loop
orb->run();
}
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]