<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>844</bug_id>
          
          <creation_ts>2011-03-10 15:50:53 +0000</creation_ts>
          <short_desc>GDB hangs when trying to debug zypper, libzypper, c++ combination</short_desc>
          <delta_ts>2011-03-15 09:03:12 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>1.0-alpha</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>High</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>1.0 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Hatle">mark.hatle</reporter>
          <assigned_to name="Nitin Kamble">nitin.a.kamble</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>12458</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-03-10 15:50:53 +0000</bug_when>
    <thetext>I am experiencing a hang when trying to debug zypper on an x86 QEMU configuration.  The hang occurs after I put in the libzypper debug package.

To reproduce the hang:

1) build poky-image-base
2) start qemu and log in as root

3) download:

eglibc-dbg-*.i586.rpm
gcc-runtime-*.i586.rpm
rpm-dbg-*.i586.rpm
libzypp-dbg-*.i586.rpm
zypper-dbg-*.i586.rpm

4) Install the packages using:

rpm -Uhv *-dbg*

5) launch gdb:

gdb --args zypper pa

6) setup a break point and attempt to run

break main
run


Results:

(gdb) break main
Breakpoint 1 at 0x8079f47: file /usr/src/debug/zypper-1.5.3-git1+2c5bb6ceb99ecd950ef993e43d77bf0569ea0582-r4/git/src/main.cc, line 57.
(gdb) run
Starting program: /usr/bin/zypper pa
[Thread debugging using libthread_db enabled]
&lt;freezes here, system/gdb is unresponsive&gt;

If I do NOT install libzypper then the system does not hang.  However, I need it to debug various calls from the library into RPM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12459</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-03-10 16:05:18 +0000</bug_when>
    <thetext>note, the work was done using the components from the poky-contrib/mhatle/bernard/fixes tree.  Specifically commits:

588d20caa2bc31465da4a9df20906310105f8b8c
a0c1c7d647b356f86de2574b70af102d50494c77
3bde974074b2a4d31cbb8afae9e93372dd70fe13
466cc2565c4497bd56351049186543b9bf53fc0d

All of which have a pull request pending.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12503</commentid>
    <comment_count>2</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2011-03-11 10:29:13 +0000</bug_when>
    <thetext>Mark,
 Does gdb debug work for any other debug scenarios. Just checking weather is it the combination issue or just the gdb issue. It can also possibly a qemu issue.

Nitin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12505</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-03-11 10:34:30 +0000</bug_when>
    <thetext>I have been able to successfully debug rpm and other applications.  It&apos;s just zypper that is having the issue, and only when I add the libzypp debug information.  Prior to that I can debug &quot;around&quot; libzypp.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12524</commentid>
    <comment_count>4</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2011-03-12 14:20:42 +0000</bug_when>
    <thetext>Mark,
I just tried this:

1. add these lines to local.conf
 EXTRA_IMAGE_FEATURES = &quot;tools-debug tools-profile tools-testapps debug-tweaks dbg-pkgs tools-sdk&quot;
 POKY_EXTRA_INSTALL = &quot; rpm zypper libzypp &quot;

2. bitbake poky-image-base

3. poky-qemu qemux86 poky-image-base ext3

4. inside qemu, login &amp; run these commands

root@qemux86:~# gdb --args zypper pa
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type &quot;show copying&quot;
and &quot;show warranty&quot; for details.
This GDB was configured as &quot;i586-poky-linux&quot;.
For bug reporting instructions, please see:
&lt;http://www.gnu.org/software/gdb/bugs/&gt;...
Reading symbols from /usr/bin/zypper...(no debugging symbols found)...done.
(gdb) break main
Breakpoint 1 at 0x8079f41
(gdb) run
Starting program: /usr/bin/zypper pa
[Thread debugging using libthread_db enabled]

Breakpoint 1, 0x08079f41 in main ()
(gdb) bt
#0  0x08079f41 in main ()
(gdb) 

And the breakpoint was hit, without hanging.

5. I also checked installed zypper rpms
  root@qemux86:~# rpm -qa | grep zypp
  libzypp-0.0+git1+15b6c52260bbc52b3d8e585e271b67e10cc7c433-r6.i586
  zypper-1.5.3+git1+2c5bb6ceb99ecd950ef993e43d77bf0569ea0582-r4.i586</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12564</commentid>
    <comment_count>5</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-03-14 14:18:14 +0000</bug_when>
    <thetext>I followed your steps, however no crash occurs because the -dbg files were not installed onto the target.


gcc-runtime-*.i586.rpm
rpm-dbg-*.i586.rpm
libzypp-dbg-*.i586.rpm
zypper-dbg-*.i586.rpm


are all missing on the target image.  Without gcc-runtime, you won&apos;t be able to debug C++ apps.  Without rpm, libzypp and zypper dbg you can&apos;t step though those functions.

Looking at your output, the DBG didn&apos;t get loaded otherwise the break point would have shown corresponding source code... none was displayed -- just raw memory addresses.

Try to reproduce it by copying the missing -dbg files to the target and installing them manually.  (or verify they are there using &quot;rpm -qa | grep &lt;package&gt;&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12582</commentid>
    <comment_count>6</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2011-03-14 17:50:49 +0000</bug_when>
    <thetext>Mark,
  Right, some hf the .dbg rpms are not installed. I will try reproducing again.

Thanks,
Nitin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12583</commentid>
    <comment_count>7</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2011-03-14 17:59:52 +0000</bug_when>
    <thetext>Mark,
  I installed these rpms:
gcc-runtime-dbg-4.5.1-r4.i586.rpm  
rpm-dbg-5.4.0-r14.i586.rpm  
libzypp-dbg-0.0+git1+15b6c52260bbc52b3d8e585e271b67e10cc7c433-r6.i586.rpm 
zypper-dbg-1.5.3+git1+2c5bb6ceb99ecd950ef993e43d77bf0569ea0582-r4.i586.rpm 

And retried reproducing the issue.
after the gdb break, &amp; run I saw out of memory errors.

Thanks,
Nitin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12584</commentid>
    <comment_count>8</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2011-03-14 18:15:45 +0000</bug_when>
    <thetext>Mark,
 after I giving more memory to qemu I am not seeing the hang anymore.

This is how I ran qemu.
$ poky-qemu qemux86 poky-image-base ext3 &quot;&lt;-m 1024&gt;&quot;
So this is actually the memory need issue. Didn&apos;t see the code but the line numbers are showing up, so if the real code is placed in there, gdb will able to show the real code by line numbers.

Thanks,
Nitin


root@qemux86:~# gdb --args zypper pa
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type &quot;show copying&quot;
and &quot;show warranty&quot; for details.
This GDB was configured as &quot;i586-poky-linux&quot;.
For bug reporting instructions, please see:
&lt;http://www.gnu.org/software/gdb/bugs/&gt;...
Reading symbols from /usr/bin/zypper...Reading symbols from /usr/bin/.debug/zypper...done.
done.
(gdb) break main
ruBreakpoint 1 at 0x8079f47: file /usr/src/debug/zypper-1.5.3-git1+2c5bb6ceb99ecd950ef993e43d77bf0569ea0582-r4/git/src/main.cc, line 57.
(gdb) run
Starting program: /usr/bin/zypper pa
[Thread debugging using libthread_db enabled]
Traceback (most recent call last):
  File &quot;/usr/lib/libstdc++.so.6.0.14-gdb.py&quot;, line 52, in &lt;module&gt;
    objfile = gdb.current_objfile ().filename
LookupError: no codec search functions registered: can&apos;t find encoding

Breakpoint 1, main (argc=2, argv=0xbffffda4)
    at /usr/src/debug/zypper-1.5.3-git1+2c5bb6ceb99ecd950ef993e43d77bf0569ea0582-r4/git/src/main.cc:57
57	/usr/src/debug/zypper-1.5.3-git1+2c5bb6ceb99ecd950ef993e43d77bf0569ea0582-r4/git/src/main.cc: No such file or directory.
	in /usr/src/debug/zypper-1.5.3-git1+2c5bb6ceb99ecd950ef993e43d77bf0569ea0582-r4/git/src/main.cc
(gdb) list
52	in /usr/src/debug/zypper-1.5.3-git1+2c5bb6ceb99ecd950ef993e43d77bf0569ea0582-r4/git/src/main.cc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12592</commentid>
    <comment_count>9</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-03-14 19:15:42 +0000</bug_when>
    <thetext>I was able to verify that increasing the amount of memory for the QEMU session resolved the issue I was having!

For some reason my system wasn&apos;t able to tell me it was out of memory -- but it works now that I&apos;ve increased the running memory.  We should likely add some comments about debugging on-target and increasing run-time memory requirements.

I&apos;m setting this as RESOLVED -- NOTABUG, because the failure is expected once you understand the cause (out of memory).

Thanks for the investigation!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12627</commentid>
    <comment_count>10</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2011-03-15 08:39:41 +0000</bug_when>
    <thetext>Mark,
   If I ssh into the system and run the test, then at the time of failure no clue is given. But if you log inside qemu then kernel prints out of memory messages and shows which processes got killed.
   I guess you were not running on the qemu console.

Thanks,
Nitin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12634</commentid>
    <comment_count>11</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-03-15 09:03:12 +0000</bug_when>
    <thetext>Actually I am logged into the QEMU console (via nographic).  I think the main problem is when the kernel runs out of memory, you don&apos;t always get notified... and this is just one of those cases.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>