Re: gdb works abnormally when debug the libvirt.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29.11.2011 11:32, ShaoHe Feng wrote:
> When I  to use gdb to check whether qemuMonitorJSONIOProcessEvent
> processes the Event that I expect.
> 
> but the gdb works  abnormally.
> I list the the position of the source file by gdb. It is the correct
> functionqemuMonitorJSONIOProcessEvent.
> However I set break point on this  position. then "info b", it is the
> wrong function qemuMonitorJSONIOProcess.
> 
> I debug my libvirt on Ubuntu 11.10 this time.But I have set  a break
> point at this function on redhat 6.0 before, it can work well.
> 
> My gcc version is: gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
> My gdb version is: GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
> 
> here is the info:
> 
> (gdb) list qemu/qemu_monitor_json.c:88
> 83    qemuMonitorJSONIOProcessEvent(qemuMonitorPtr mon,
> 84                                  virJSONValuePtr obj)
> 85    {
> 86        const char *type;
> 87        int i;
> 88        int findEventFlag = -1;
> 89        VIR_DEBUG("mon=%p obj=%p", mon, obj);
> 90   
> 91        type = virJSONValueObjectGetString(obj, "event");
> 92        if (!type) {
> 
> 
> 
> (gdb) b qemu/qemu_monitor_json.c:88
> Breakpoint 5 at 0x4a18d4: file qemu/qemu_monitor_json.c, line 88.
> (gdb) info b
> Num     Type           Disp Enb Address            What
> 5       breakpoint     keep y   0x00000000004a18d4 in
> qemuMonitorJSONIOProcess at qemu/qemu_monitor_json.c:88
> (gdb)
> 
> 

This may be caused by libvirtd being compiled with -O2; You want to turn
that off:
1) get libvirt sources, unpack them and cd <unpacked sources>
2) export CFLAGS='-O0'
3) ./autogen --system && make

Now you should have libvirtd in ./daemon/libvirtd; However, this is
libtool wrapper script. So you won't succeed running it directly (gdb
./daemon/libvirtd); I personally use attach: gdb -p $(pgrep libvirtd);
NB, you should shutdown your system libvirtd: service libvirtd shutdown

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]