Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1027)

Unified Diff: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerGDB.cs

Issue 10915292: Use irt from within chrome install (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerGDB.cs
diff --git a/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerGDB.cs b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerGDB.cs
index f4cebfe179bd270e6cd4bec86e72f39459e4cbc8..6dd27216f585f4c733625381aa53557fcdbac9bf 100644
--- a/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerGDB.cs
+++ b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerGDB.cs
@@ -8,6 +8,7 @@ namespace NativeClientVSAddIn
using System.IO;
using System.Text;
using System.Windows.Forms;
+ using System.Diagnostics;
using EnvDTE;
using EnvDTE80;
@@ -60,7 +61,71 @@ namespace NativeClientVSAddIn
public PluginDebuggerGDB(DTE2 dte, PropertyManager properties)
: base(dte, properties)
{
- irtPath_ = properties.IrtPath;
+ string arch = "i686";
+ if (Environment.Is64BitOperatingSystem)
+ {
+ arch = "x86_64";
+ }
+
+ if (properties.TargetArchitecture != arch)
+ {
+ MessageBox.Show(string.Format("Debugging of {0} NaCl modules is not possible on this system ({1}).",
binji 2012/09/17 21:54:06 nit: wrap at 100
+ properties.TargetArchitecture, arch));
+ }
+
+ // check chrome version
binji 2012/09/17 21:54:06 Not necessary for this CL, but these checks feel l
+ string chrome_path = properties.LocalDebuggerCommand;
+ FileVersionInfo version_info = FileVersionInfo.GetVersionInfo(chrome_path);
+ string file_version = version_info.FileVersion;
+ if (file_version != null)
+ {
+ string major_version = file_version.Split('.')[0];
+ int major_version_int = 0;
+ try
+ {
+ major_version_int = Convert.ToInt32(major_version);
+ }
+ catch
+ {
+ }
+ if (major_version_int < 22)
+ {
+ MessageBox.Show("Chrome 22 or above required for NaCl debugging (your version is "
+ + major_version + ")");
+ return;
+ }
+ }
+
+ // We look for the IRT in several ways, mimicing what chrome itself
binji 2012/09/17 21:54:06 nit: mimicking
+ // does in chrome/app/client_util.cc:MakeMainDllLoader.
+
+ // First look for the IRT alongside chrome.exe
+ string irt_basename = "nacl_irt_" + arch + ".nexe";
+ irtPath_ = Path.Combine(Path.GetDirectoryName(chrome_path), irt_basename);
+ if (!File.Exists(irtPath_))
+ {
+ // Next look for a folder alongside chrome.exe with the same name
+ // as the version embedded in chrome.exe.
+ if (file_version == null)
binji 2012/09/17 21:54:06 nit: the comment above makes it seem like this che
+ {
+ if (!File.Exists(irtPath_))
binji 2012/09/17 21:54:06 pull this common code out
+ {
+ MessageBox.Show("NaCL IRT not found in chrome install.\nLooking for: " + irtPath_);
+ irtPath_ = null;
+ }
+ }
+ else
+ {
+ irtPath_ = Path.Combine(Path.GetDirectoryName(chrome_path),
+ file_version, irt_basename);
+ if (!File.Exists(irtPath_))
+ {
+ MessageBox.Show("NaCL IRT not found in chrome install.\nLooking for: " + irtPath_);
+ irtPath_ = null;
+ }
+ }
+ }
+
manifestPath_ = properties.ManifestPath;
pluginAssembly_ = properties.PluginAssembly;
pluginProjectDirectory_ = properties.ProjectDirectory;
@@ -162,8 +227,14 @@ namespace NativeClientVSAddIn
contents.AppendFormat("file \"{0}\"\n", pluginAssemblyEscaped);
}
- string irtPathEscaped = irtPath_.Replace("\\", "\\\\");
- contents.AppendFormat("nacl-irt {0}\n", irtPathEscaped);
+ // irtPath_ could be null if the irt nexe was not found in the chrome
+ // install.
+ if (irtPath_ != null)
+ {
+ string irtPathEscaped = irtPath_.Replace("\\", "\\\\");
+ contents.AppendFormat("nacl-irt \"{0}\"\n", irtPathEscaped);
+ }
+
contents.AppendFormat("target remote localhost:{0}\n", 4014);
// Insert breakpoints from Visual Studio project.

Powered by Google App Engine
This is Rietveld 408576698