[Pkg-cli-apps-commits] [SCM] monodevelop-debugger-gdb branch, upstream, updated. b5748e96cfad4f4bad907f68e0aa3307e5ca495b
Mirco Bauer
meebey at meebey.net
Sat Mar 28 03:05:00 UTC 2009
The following commit has been merged in the upstream branch:
commit b5748e96cfad4f4bad907f68e0aa3307e5ca495b
Author: Mirco Bauer <meebey at meebey.net>
Date: Sat Mar 28 03:51:32 2009 +0100
Imported Upstream version 1.9.3
diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs
index 391be76..6c10d0b 100644
--- a/AssemblyInfo.cs
+++ b/AssemblyInfo.cs
@@ -5,5 +5,5 @@ using System.Reflection;
[assembly: AssemblyProduct ("MonoDevelop")]
[assembly: AssemblyTitle ("GDB support for Mono.Debugging")]
[assembly: AssemblyDescription ("GNU Debugger support for Mono.Debugging")]
-[assembly: AssemblyVersion ("1.9.2")]
+[assembly: AssemblyVersion ("1.9.3")]
[assembly: AssemblyCopyright ("MIT X11")]
diff --git a/GdbSessionFactory.cs b/GdbSessionFactory.cs
index dd7ef88..95ab72b 100644
--- a/GdbSessionFactory.cs
+++ b/GdbSessionFactory.cs
@@ -35,19 +35,65 @@ namespace MonoDevelop.Debugger.Gdb
{
public class GdbSessionFactory: IDebuggerEngine
{
+ struct FileData {
+ public DateTime LastCheck;
+ public bool IsExe;
+ }
+
+ Dictionary<string,FileData> fileCheckCache = new Dictionary<string, FileData> ();
+
public string Name {
get { return "GNU Debugger (GDB)"; }
}
- public bool CanDebugPlatform (string platformId)
+ public bool CanDebugCommand (string file)
{
- return platformId == "Native";
+ string ext = System.IO.Path.GetExtension (file).ToLower ();
+ if (ext == ".exe" || ext == ".dll")
+ return false;
+ file = FindFile (file);
+ if (!File.Exists (file)) {
+ // The provided file is not guaranteed to exist. If it doesn't
+ // we assume we can execute it because otherwise the run command
+ // in the IDE will be disabled, and that's not good because that
+ // command will build the project if the exec doesn't yet exist.
+ return true;
+ }
+
+ file = Path.GetFullPath (file);
+ DateTime currentTime = File.GetLastWriteTime (file);
+
+ FileData data;
+ if (fileCheckCache.TryGetValue (file, out data)) {
+ if (data.LastCheck == currentTime)
+ return data.IsExe;
+ }
+ data.LastCheck = currentTime;
+ try {
+ data.IsExe = IsExecutable (file);
+ } catch {
+ data.IsExe = false;
+ }
+ fileCheckCache [file] = data;
+ return data.IsExe;
}
- public bool CanDebugFile (string file)
+ public bool IsExecutable (string file)
{
- string ext = System.IO.Path.GetExtension (file).ToLower ();
- return ext != ".exe" && ext != ".dll";
+ // HACK: this is a quick but not very reliable way of checking if a file
+ // is a native executable. Actually, we are interested in checking that
+ // the file is not a script.
+ using (StreamReader sr = new StreamReader (file)) {
+ char[] chars = new char[3];
+ int n = 0, nr = 0;
+ while (n < chars.Length && (nr = sr.ReadBlock (chars, n, chars.Length - n)) != 0)
+ n += nr;
+ if (nr != chars.Length)
+ return true;
+ if (chars [0] == '#' && chars [1] == '!')
+ return false;
+ }
+ return true;
}
public DebuggerFeatures SupportedFeatures {
@@ -82,5 +128,18 @@ namespace MonoDevelop.Debugger.Gdb
return procs.ToArray ();
}
+ string FindFile (string cmd)
+ {
+ if (Path.IsPathRooted (cmd))
+ return cmd;
+ string pathVar = Environment.GetEnvironmentVariable ("PATH");
+ string[] paths = pathVar.Split (Path.PathSeparator);
+ foreach (string path in paths) {
+ string file = Path.Combine (path, cmd);
+ if (File.Exists (file))
+ return file;
+ }
+ return cmd;
+ }
}
}
diff --git a/Manifest.addin.xml b/Manifest.addin.xml
index 8914af3..9602c3e 100644
--- a/Manifest.addin.xml
+++ b/Manifest.addin.xml
@@ -5,12 +5,12 @@
description = "GNU Debugger support for Mono.Debugging"
copyright = "MIT X11"
category = "Debugging"
- version = "1.9.2">
+ version = "1.9.3">
<Dependencies>
- <Addin id="MonoDevelop.Core" version="1.9.2"/>
- <Addin id="MonoDevelop.Ide" version="1.9.2"/>
- <Addin id="MonoDevelop.Debugger" version="1.9.2"/>
+ <Addin id="MonoDevelop.Core" version="1.9.3"/>
+ <Addin id="MonoDevelop.Ide" version="1.9.3"/>
+ <Addin id="MonoDevelop.Debugger" version="1.9.3"/>
</Dependencies>
<Extension path="/MonoDevelop/Debugging/DebuggerFactories">
diff --git a/configure b/configure
index 981b37d..a8d72e3 100755
--- a/configure
+++ b/configure
@@ -1,10 +1,10 @@
#!/bin/bash
-VERSION=1.9.2
+VERSION=1.9.3
PACKAGE=monodevelop-debugger-gdb
prefix=/usr/local
config=DEBUG
configurations=" RELEASE DEBUG"
-common_packages=" monodevelop;1.9.2"
+common_packages=" monodevelop;1.9.3"
usage ()
--
monodevelop-debugger-gdb
More information about the Pkg-cli-apps-commits
mailing list