Sane, Abhijeet
2009-Dec-29 08:50 UTC
[Xen-devel] libxenserver : xen_vm_get_record() fails with SIGSEGV
Hi , I am getting a SIGSEGV when calling xen_vm_get_record() function. Please guide me if I am doing anything wrong. <CodeSnippet> struct xen_vm_set * vm_list = NULL; //xen_vm_get_all(session,&vm_list); xen_host_get_resident_vms(session,&vm_list,host); if ( NULL == vm_list ) { print_error(session); xen_host_free(host); cleanup(); return 1; } printf("Total number of virtual machines found on Xen Server %d\n",vm_list->size); for(int i = 0 ; i < vm_list->size ; i++) { xen_vm_record * vm_rec = NULL; printf("Trying to get VM record\n"); //--- This is where it fails xen_vm_get_record(session,&vm_rec ,*( vm_list->contents[i])); if ( NULL == vm_rec ) { print_error(session); xen_host_free(host); cleanup(); return 1; } printf("(%d) == > UUID = %s ",i,vm_rec->uuid); } </CodeSnippet> I am using the following libraries for development XenServer Product Information ------------------------------ Name XenServer Version 5.5.0-15119p Xen Version 3.3.1 Kernel Version 2.6.18-128.1.6.el5.x s5.5.0.496.1012xen CURL : ------- curl-7.9.8-54 curl-devel-7.9.8-54 GCC : ----- gcc-c++-3.2.2-38 libgcc-3.2.2-38 gcc-3.2.2-38 libXML : libxml2-2.7.6 libXenServer: libxenserver-5.5.0-1 <execution trace > Starting program: ./print_host_vm [New Thread 1024 (LWP 9997)] Initializing XML Parser Initializing Xen Creating Session with login/password Session established Host has the following capabilities: xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 Host Record list UUID = 86f59fe9-6428-4742-b95e-22c284d60525 Name = xxxxxx Hostname= xxxxxxx Address = xxx.xxx.xxx.xxx Host CPU Record size = 2 CPU Configuration size 0 Total number of virtual machines found on Xen Server 3 Trying to get VM record Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1024 (LWP 9997)] xmlStringGetNodeList (doc=0x815fa08, value=0x7161704f <Address 0x7161704f out of bounds>) at tree.c:1454 1454 while (*cur != 0) { (gdb) where #0 xmlStringGetNodeList (doc=0x815fa08, value=0x7161704f <Address 0x7161704f out of bounds>) at tree.c:1454 #1 0x08067124 in xmlNewDocNode (doc=0x815fa08, ns=0x8154220, name=0x6 <Address 0x6 out of bounds>, content=0x7161704f <Address 0x7161704f out of bounds>) at tree.c:2271 #2 0x0806798c in xmlNewChild (parent=0x81541d0, ns=0x0, name=0x6 <Address 0x6 out of bounds>, content=0x7161704f <Address 0x7161704f out of bounds>) at tree.c:2843 #3 0x40030f8f in add_value (parent=0x8154180, type=0x4005c28c "string", value=0x7161704f <Address 0x7161704f out of bounds>) at src/xen_common.c:1673 #4 0x40030f32 in add_param (params_node=0x814d390, type=0x4005c28c "string", value=0x7161704f <Address 0x7161704f out of bounds>) at src/xen_common.c:1660 #5 0x400305ed in make_body_add_type (typename=STRING, v=0x814d32c, params_node=0x814d390) at src/xen_common.c:1328 #6 0x40030a23 in make_body (method_name=0x40061cbc "VM.get_record", params=0x814d320, param_count=2) at src/xen_common.c:1459 #7 0x4002efa7 in call_raw (s=0x8148630, method_name=0x40061cbc "VM.get_record", params=0x814d320, param_count=2, result_type=0xbfffeec0, value=0xbfffef4c) at src/xen_common.c:538 #8 0x4002ef21 in xen_call_ (s=0x8148630, method_name=0x40061cbc "VM.get_record", params=0xbfffeef0, param_count=1, result_type=0xbfffeec0, value=0xbfffef4c) at src/xen_common.c:518 #9 0x40053b6b in xen_vm_get_record (session=0x8148630, result=0xbfffef4c, vm=0x7161704f) at src/xen_vm.c:311 #10 0x0804aaaf in main () #11 0x401824c2 in __libc_start_main () from /lib/i686/libc.so.6 (gdb) </execution trace> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Goncalo Gomes
2009-Dec-29 10:58 UTC
Re: [Xen-devel] libxenserver : xen_vm_get_record() fails with SIGSEGV
Hi, Sane, Abhijeet wrote:> Hi , > > I am getting a SIGSEGV when calling xen_vm_get_record() function. > Please guide me if I am doing anything wrong. > > <CodeSnippet> > struct xen_vm_set * vm_list = NULL; > //xen_vm_get_all(session,&vm_list); > xen_host_get_resident_vms(session,&vm_list,host); > if ( NULL == vm_list ) > { > print_error(session); > xen_host_free(host); > cleanup(); > return 1; > } > > printf("Total number of virtual machines found on Xen Server %d\n",vm_list->size); > for(int i = 0 ; i < vm_list->size ; i++) > { > xen_vm_record * vm_rec = NULL; > printf("Trying to get VM record\n"); > //--- This is where it fails > xen_vm_get_record(session,&vm_rec ,*( vm_list->contents[i])); >You don''t want to dereference that pointer, so just remove the *. Goncalo. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel