Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363688

Summary: CDT issues "auto-solib-add on" command to gdb with invalid syntax
Product: [Tools] CDT Reporter: Andras Varga <andras>
Component: cdt-debug-cdi-gdbAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, daniel_megert, eleazar4291, marc.khouzam, nobody, pawel.1.piech, praveen.bahl, vivkong
Version: 8.0Flags: nobody: iplog-
Target Milestone: 8.1.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed fix.
nobody: iplog-
Fix without API changes nobody: iplog-

Description Andras Varga CLA 2011-11-14 05:06:16 EST
Build Identifier: 3.7.1

When I debug a program, the following error appears on the console:

 auto-solib-add on
 Undefined command: "auto-solib-add".  Try "help".

The command CDT issues to gdb should be "set auto-solib-add on", i.e. the "set" word is missing. Indeed, if I type

 set auto-solib-add on

in the console, then it works:

 show auto-solib-add
 Autoloading of shared library symbols is on.

Should be an easy fix :)

Reproducible: Always
Comment 1 Andras Varga CLA 2011-11-14 05:20:37 EST
The error only appears if "GDB command set" is "CygWin".
Comment 2 Andras Varga CLA 2011-11-14 05:55:10 EST
Bug refers to the "Standard Process Launcher" (only that one has the "GDB command set" combo box).
Comment 3 Praveen Bahl CLA 2012-07-04 07:04:22 EDT
Any plan to fix this as one of our client has reported similar issue 
  Undefined command: "auto-solib-add".  Try "help".
Comment 4 Nobody - feel free to take it CLA 2012-07-20 10:40:00 EDT
At the time when this code was written there was no support for shared libraries on Windows. The message you see in the console is the result of a (rather clumsy) way to suppress 'set auto-solib-add'. It doesn't affect the debugging and should be ignored.
Enabling 'set auto-solib-add' is simple but it would open a whole can of worms. We simply don't have enough resources to do this work and are focused on DSF/GDB which I would recommend.
Comment 5 Vivian Kong CLA 2012-10-02 09:14:11 EDT
Hi Mikhail, can we suppress the message this way for Cygwin?

diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java
index f923654..f62b788 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 QNX Software Systems and others.
+ * Copyright (c) 2000, 2012 QNX Software Systems and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -45,6 +45,7 @@
 import org.eclipse.cdt.debug.mi.core.command.MIGDBShow;
 import org.eclipse.cdt.debug.mi.core.command.MIGDBShowSolibSearchPath;
 import org.eclipse.cdt.debug.mi.core.command.MIInfoSharedLibrary;
+import org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory;
 import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
 import org.eclipse.cdt.debug.mi.core.event.MIEvent;
 import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent;
@@ -273,6 +274,9 @@
 	public void setAutoLoadSymbols(Target target, boolean set) throws CDIException {
 		MISession mi = target.getMISession();
 		CommandFactory factory = mi.getCommandFactory();
+		if (factory instanceof CygwinCommandFactory) {
+			return;
+		}
 		MIGDBSetAutoSolib solib = factory.createMIGDBSetAutoSolib(set);
 		try {
 			mi.postCommand(solib);
Comment 6 Nobody - feel free to take it CLA 2012-10-02 13:03:38 EDT
Created attachment 221792 [details]
Proposed fix.

Hi Vivien, the attached patch should suppress the error message. I don't have environment to test it properly. Can you give it a try and commit it if it works?
Thanks
Comment 7 Vivian Kong CLA 2012-10-02 16:11:26 EDT
(In reply to comment #6)
> Created attachment 221792 [details]
> Proposed fix.
> 
> Hi Vivien, the attached patch should suppress the error message. I don't
> have environment to test it properly. Can you give it a try and commit it if
> it works?
> Thanks


Thanks a lot Mikhail.  I don't see that error message anymore.  I'll commit this.
Comment 8 Vivian Kong CLA 2012-10-02 16:16:00 EDT
(In reply to comment #7)
> Thanks a lot Mikhail.  I don't see that error message anymore.  I'll commit
> this.

Actually my company policy does not allow me to commit code from other companies.  Can you please commit this to cdt_8_1 and master please?  Thanks!
Comment 9 Nobody - feel free to take it CLA 2012-10-03 11:14:19 EDT
Created attachment 221845 [details]
Fix without API changes
Comment 10 Nobody - feel free to take it CLA 2012-10-03 11:17:43 EDT
The patch is modified to avoid API changes and committed to master and cdt_8_1. Vivian, please try it and let me know if something is wrong.
Comment 11 Vivian Kong CLA 2012-10-04 13:22:56 EDT
(In reply to comment #10)
> The patch is modified to avoid API changes and committed to master and
> cdt_8_1. Vivian, please try it and let me know if something is wrong.

Thanks Mikhail.  Everything looks good.
Comment 12 Praveen Bahl CLA 2012-10-16 04:47:59 EDT
How I can get this patch ? Can someone provide me the details ?
Comment 13 CDT Genie CLA 2013-02-27 11:53:02 EST
*** cdt git genie on behalf of Mikhail Khodjaiants ***

    Bug 363688 - CDT issues &quot;auto-solib-add on&quot; command to gdb with invalid
    syntax

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=afda71bc567c7da5dbabce59d8182385d923d0c2
Comment 14 CDT Genie CLA 2013-02-27 11:53:05 EST
*** cdt git genie on behalf of Mikhail Khodjaiants ***

    Bug 363688 - CDT issues &quot;auto-solib-add on&quot; command to gdb with invalid
    syntax

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=c14712793d0702fb9ddd0f719cd1994e6917a0b0
Comment 15 CDT Genie CLA 2013-02-27 11:53:25 EST
*** cdt git genie on behalf of Mikhail Khodjaiants ***

    Bug 363688 - CDT issues &quot;auto-solib-add on&quot; command to gdb with invalid
    syntax - backport to cdt_7_0

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=2e9b12047437c06d8119c95cce9d61a7b919d325