Bug 74585

Summary: Unable to debug Hello World C++ program
Product: [Applications] kdevelop Reporter: Casteyde.Christian <casteyde.christian>
Component: CPP DebuggerAssignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Casteyde.Christian 2004-02-08 16:52:57 UTC
Version:            (using KDE KDE 3.2.0)
Installed from:    Compiled From Sources
Compiler:          gcc 3.3.3 20040202 (prerelease) 
OS:          Linux

I think 49496 should be reopened for KDevelop 3.0.0/KDE3.2
since it still doesn't work. Removing the libtool in
project debugging options does solve the problem,
but the template is STILL false.

I use gdb 6.0, autoconf 2.57, automake 1.7.7 (slack 9.1).
Simple Hello world + Build + Debug gives :

/bin/sh -c /home/christian/testkdev/debug/libtool gdb /home/christian/testkdev/debug/src/testkdev -fullname -nx -quiet
(gdb) set edit off 
(gdb) set confirm off 
Excess command line arguments ignored. ("-nx" ...)
GNU gdb 6.0
Copyright 2003 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 "i686-pc-linux-gnu"...
"/home/christian/testkdev/debug/src/testkdev": Aucun fichier ou répertoire de ce type.


/home/christian/testkdev/"-fullname": Aucun fichier ou répertoire de ce type.

(gdb) 
(gdb) 
(gdb) set print static-members off 
(gdb) tty /dev/pts/2 
(gdb) set width 0 
(gdb) set height 0 
(gdb) set stop-on 1 
(gdb) handle SIG32 pass nostop noprint 
(gdb) handle SIG43 pass nostop noprint 
(gdb) set print asm-demangle on 
(gdb) cd /home/christian/testkdev/debug/src 
(gdb) break testkdev.cpp:22 
No symbol table is loaded.  Use the "file" command.

(gdb) run 
No executable file specified.
Use the "file" or "exec-file" command.
Comment 1 Daniel Franke 2004-02-08 17:25:05 UTC
Some comment that may be related:
removing the libtool-shell worked for me, but the 'run'-argument specified in debugger options isn't set, i.e. if a command-line argument is needed, say a filename. The debuggerpart runs the executable without this argument:

With 'libtool' (and program arguments set):
---
/bin/sh -c /home/franke/cvs/sibsim/package/debug/libtool gdb /home/franke/cvs/sibsim/package/debug/src/sibsim -fullname -nx -quiet
(gdb) set edit off 
(gdb) set confirm off 
Excess command line arguments ignored. ("-nx" ...)
GNU gdb 5.3
Copyright 2002 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 "i586-suse-linux"...
"/home/franke/cvs/sibsim/package/debug/src/sibsim": No such file or directory.


/home/franke/cvs/sibsim/package/"-fullname": No such file or directory.

(gdb) 
(gdb) 
---

Without 'libtool' (and program arguments set):
---
 gdb /home/franke/cvs/sibsim/package/debug/src/sibsim -fullname -nx -quiet
(gdb) set edit off 
(gdb) set confirm off 
(gdb) 
(gdb) 
(gdb) set print static-members off 
(gdb) tty /dev/pts/3 
(gdb) set width 0 
(gdb) set height 0 
(gdb) set stop-on 1 
(gdb) handle SIG32 pass nostop noprint 
(gdb) handle SIG43 pass nostop noprint 
(gdb) set print asm-demangle on 
(gdb) cd /home/franke/cvs/sibsim/package/debug/src 
(gdb) run 		[<-------- argument not set here]
[New Thread 16384 (LWP 15917)]
Stopped due to shared library event
(gdb) continue 
[Switching to Thread 16384 (LWP 15917)]
Stopped due to shared library event
(gdb) continue 
Stopped due to shared library event
(gdb) continue 

Program exited with code 01.
--

Comment 2 Jens Dagerbo 2004-02-08 20:55:53 UTC
"Removing the libtool in project debugging options does solve the problem, but the template is STILL false."

Technically, no. The template is correct, but the debugger plugin code is wrong.


See also bug #58999
Comment 3 John Birch 2004-02-09 10:02:34 UTC
Hmmm

I've read bug #58999 and this is a duplicate of that bug but I'm not sure there is a problem in the debugger code. At least i can't see it.

Here's the code (minus extra lines) that start the debugger

    if (!shell.isEmpty())
    {
        *dbgProcess_ << "/bin/sh" << "-c" << shell + " " +config_gdbPath_
                      + "gdb " + application + " -fullname -nx -quiet";
    }
    else
    {
        *dbgProcess_ << config_gdbPath_ + "gdb" << application
                        << "-fullname" << "-nx" << "-quiet";
    }

        *dbgProcess_ << "/bin/sh" << "-c" << shell + " " +config_gdbPath_
                      + "gdb " + application + " -fullname -nx -quiet";


And this is what it produces

/bin/sh -c /home/franke/cvs/sibsim/package/debug/libtool gdb /home/franke/cvs/sibsim/package/debug/src/sibsim -fullname -nx -quiet 

This looks fine to me as a startup command for libtool but we get
the error message "Excess command line arguments ignored. ("-nx" ...)"

Now Roger mentions a problem with seeing '"--fullname"' but I don't see this and Christians output above also doesn't show this type of problem as the strings seem to be expanded properly.

But there is a problem :(

What should we try next? Send bits of code and an explanation to everyone else that's in the dark, please :-)

jbb
Comment 4 Jens Dagerbo 2004-02-09 11:02:02 UTC
OK, I retract comment #2. The template IS wrong. Sort of. It appears that when the debugger plugin doesn't find any settings at all it "invents" what it feels is a reasonable default - this is when the libtool option is put in despite not existing in the template.

So, for the "template workaround" to work, the template needs to be explicit in not wanting a debugging shell.

I'll try to fix the template(s) now..


(The larger problem (I guess from reading bug #58999) is that even with the libtool option, it should work. But does not. Correct?) /me really needs to read up on libtool...
Comment 5 Jens Dagerbo 2004-02-21 05:29:40 UTC
This should hopefully work now, with the updated admin files released with 3.0.1.

Assuming fixed.