[Xen-devel] Fwd: Fwd: LibXL

2015-09-22 Thread kumara rathnavel
>
>
> Hello All,
>
> I am not able to use the library functions provided by the LibXenlight
> though I am able to use it through XL. I am in need to develop my own CLI
> . I am able to perform few basic operations like listing the VM, reboot
> and all. But the calls that require a structure to be filled is not
> functioning . I am getting a segmentation fault.
>
> I have attached my code. I have also attached the system call traces file
> which was generated by the command truss for the command that was
> successful through XL and the other one that failed where I used the call
> directly.
>
> Thank you
>
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#define INVALID_DOMID 0
#define LIBXL__DEFBOOL_FALSE (-1)
#define LIBXL__DEFBOOL_TRUE (1)

int
main(
 int argc,
 char **argv
  )
{
   libxl_ctx *ctx;

   int rc = 0;

   libxl_device_nic nic;
   int domid = 0;
   char *bridge = NULL;

   bridge = "bridge0";


   libxl_device_nic_init();


   domid = 2; //Have a domain running with ID 2.

   rc = libxl_ctx_alloc(, LIBXL_VERSION, 0, NULL);
   if (rc < 0) {
  perror("ctx alloc failed.");
  return rc;
   }

   nic.devid = -1;
   nic.bridge = bridge;
   nic.nictype = LIBXL_NIC_TYPE_VIF;

   rc = libxl_device_nic_add(ctx, domid, , 0);
   if(rc != 0 ) {
  printf("Attach Failed\n");
   }

   libxl_ctx_free(ctx);
   return rc;
}

xlout
Description: Binary data


eout
Description: Binary data
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] Fwd: Fwd: LibXL

2015-09-22 Thread kumara rathnavel
Hello Ian,

As requested I have attached the gdb output of the code.

On 22 September 2015 at 15:21, Ian Campbell  wrote:

> On Tue, 2015-09-22 at 14:50 +0530, kumara rathnavel wrote:
>
> > > I have attached my code. I have also attached the system call traces
> file
> > > which was generated by the command truss for the command that was
> > > successful through XL and the other one that failed where I used the
> call
> > > directly.
>
> I'm afraid that truss is of very little use for debugging these sorts of
> issues.
>
> What you need is to run the program under a debugger (such as gdb) and to
> get a stack trace from the point of the segfault.
>
> Ian.
>
>
>
[root@snw-xen ~/test]# gdb exec exec.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `exec'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libxenlight.so.4.5...Error while reading 
shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxenlight.so.4.5]
Reading symbols from /usr/local/lib/libxlutil.so.4.3...Error while reading 
shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxlutil.so.4.3]
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /usr/local/lib/libxenctrl.so.4.5...Error while reading 
shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxenctrl.so.4.5]
Reading symbols from /usr/local/lib/libxenguest.so.4.5...Error while reading 
shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxenguest.so.4.5]
Reading symbols from /usr/local/lib/libxenstore.so.3.0...Error while reading 
shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxenstore.so.3.0]
Reading symbols from /lib/libutil.so.9...done.
Loaded symbols for /lib/libutil.so.9
Reading symbols from /usr/local/lib/libyajl.so.2...done.
Loaded symbols for /usr/local/lib/libyajl.so.2
Reading symbols from /lib/libthr.so.3...done.
Loaded symbols for /lib/libthr.so.3
Reading symbols from /usr/lib/libbz2.so.4...done.
Loaded symbols for /usr/lib/libbz2.so.4
Reading symbols from /usr/lib/liblzma.so.5...done.
Loaded symbols for /usr/lib/liblzma.so.5
Reading symbols from /usr/local/lib/liblzo2.so.2...done.
Loaded symbols for /usr/local/lib/liblzo2.so.2
Reading symbols from /lib/libz.so.6...done.
Loaded symbols for /lib/libz.so.6
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x000801060679 in ?? () from /usr/local/lib/libxenctrl.so.4.5
[New Thread 802c06400 (LWP 100075/)]
(gdb) bt
#0  0x000801060679 in ?? () from /usr/local/lib/libxenctrl.so.4.5
#1  0x0008008816cf in ?? () from /usr/local/lib/libxenlight.so.4.5
#2  0x0001 in ?? ()
#3  0x0008008816cf in ?? () from /usr/local/lib/libxenlight.so.4.5
#4  0x00080087e03e in ?? () from /usr/local/lib/libxenlight.so.4.5
#5  0x000800880c90 in ?? () from /usr/local/lib/libxenlight.so.4.5
#6  0x in ?? ()
(gdb) run
Starting program: /root/test/exec
Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxenlight.so.4.5]
Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxlutil.so.4.3]
Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxenctrl.so.4.5]
Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxenguest.so.4.5]
Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in 
module /usr/local/lib/libxenstore.so.3.0]

Program received signal SIGSEGV, Segmentation fault.
0x000801060679 in ?? () from /usr/local/lib/libxenctrl.so.4.5
(gdb)
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] Fwd: Fwd: LibXL

2015-09-22 Thread Ian Campbell
On Tue, 2015-09-22 at 14:50 +0530, kumara rathnavel wrote:

> > I have attached my code. I have also attached the system call traces file
> > which was generated by the command truss for the command that was
> > successful through XL and the other one that failed where I used the call
> > directly.

I'm afraid that truss is of very little use for debugging these sorts of
issues.

What you need is to run the program under a debugger (such as gdb) and to
get a stack trace from the point of the segfault.

Ian.



___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel