| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 namespace NativeClientVSAddIn | 5 namespace NativeClientVSAddIn |
| 6 { | 6 { |
| 7 using System; | 7 using System; |
| 8 using System.IO; | 8 using System.IO; |
| 9 using System.Text; | 9 using System.Text; |
| 10 using System.Windows.Forms; | 10 using System.Windows.Forms; |
| 11 using System.Diagnostics; |
| 11 | 12 |
| 12 using EnvDTE; | 13 using EnvDTE; |
| 13 using EnvDTE80; | 14 using EnvDTE80; |
| 14 | 15 |
| 15 /// <summary> | 16 /// <summary> |
| 16 /// This class handles the details of finding a nexe and attaching to it. | 17 /// This class handles the details of finding a nexe and attaching to it. |
| 17 /// </summary> | 18 /// </summary> |
| 18 public class PluginDebuggerGDB : PluginDebuggerBase | 19 public class PluginDebuggerGDB : PluginDebuggerBase |
| 19 { | 20 { |
| 20 /// <summary> | 21 /// <summary> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 private string gdbInitFileName_; | 54 private string gdbInitFileName_; |
| 54 | 55 |
| 55 /// <summary> | 56 /// <summary> |
| 56 /// Constructs the PluginDebuggerHelper. | 57 /// Constructs the PluginDebuggerHelper. |
| 57 /// </summary> | 58 /// </summary> |
| 58 /// <param name="dte">Automation object from Visual Studio.</param> | 59 /// <param name="dte">Automation object from Visual Studio.</param> |
| 59 /// <param name="properties">PropertyManager pointing to a valid project/pla
tform.</param> | 60 /// <param name="properties">PropertyManager pointing to a valid project/pla
tform.</param> |
| 60 public PluginDebuggerGDB(DTE2 dte, PropertyManager properties) | 61 public PluginDebuggerGDB(DTE2 dte, PropertyManager properties) |
| 61 : base(dte, properties) | 62 : base(dte, properties) |
| 62 { | 63 { |
| 63 irtPath_ = properties.IrtPath; | 64 string arch = "x86_32"; |
| 65 if (Environment.Is64BitOperatingSystem) |
| 66 { |
| 67 arch = "x86_64"; |
| 68 } |
| 69 string chrome_path = properties.LocalDebuggerCommand; |
| 70 FileVersionInfo version_info = FileVersionInfo.GetVersionInfo(chrome_path)
; |
| 71 string file_version = version_info.FileVersion; |
| 72 irtPath_ = Path.Combine(Path.GetDirectoryName(chrome_path), file_version,
"nacl_irt_" + arch + ".nexe"); |
| 73 if (!File.Exists(irtPath_)) |
| 74 { |
| 75 MessageBox.Show("NaCL IRT not found in chrome install.\nLooking for: " +
irtPath_); |
| 76 irtPath_ = null; |
| 77 } |
| 78 |
| 64 manifestPath_ = properties.ManifestPath; | 79 manifestPath_ = properties.ManifestPath; |
| 65 pluginAssembly_ = properties.PluginAssembly; | 80 pluginAssembly_ = properties.PluginAssembly; |
| 66 pluginProjectDirectory_ = properties.ProjectDirectory; | 81 pluginProjectDirectory_ = properties.ProjectDirectory; |
| 67 gdbPath_ = Path.Combine( | 82 gdbPath_ = Path.Combine( |
| 68 properties.SDKRootDirectory, | 83 properties.SDKRootDirectory, |
| 69 "toolchain", | 84 "toolchain", |
| 70 string.Concat("win_x86_", properties.ToolchainName), | 85 string.Concat("win_x86_", properties.ToolchainName), |
| 71 @"bin\x86_64-nacl-gdb.exe"); | 86 @"bin\x86_64-nacl-gdb.exe"); |
| 72 | 87 |
| 73 PluginFoundEvent += new EventHandler<PluginFoundEventArgs>(Attach); | 88 PluginFoundEvent += new EventHandler<PluginFoundEventArgs>(Attach); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 { | 170 { |
| 156 string manifestEscaped = manifestPath_.Replace("\\", "\\\\"); | 171 string manifestEscaped = manifestPath_.Replace("\\", "\\\\"); |
| 157 contents.AppendFormat("nacl-manifest {0}\n", manifestEscaped); | 172 contents.AppendFormat("nacl-manifest {0}\n", manifestEscaped); |
| 158 } | 173 } |
| 159 else | 174 else |
| 160 { | 175 { |
| 161 string pluginAssemblyEscaped = pluginAssembly_.Replace("\\", "\\\\"); | 176 string pluginAssemblyEscaped = pluginAssembly_.Replace("\\", "\\\\"); |
| 162 contents.AppendFormat("file \"{0}\"\n", pluginAssemblyEscaped); | 177 contents.AppendFormat("file \"{0}\"\n", pluginAssemblyEscaped); |
| 163 } | 178 } |
| 164 | 179 |
| 165 string irtPathEscaped = irtPath_.Replace("\\", "\\\\"); | 180 // irtPath_ could be null if the irt nexe was not found in the chrome |
| 166 contents.AppendFormat("nacl-irt {0}\n", irtPathEscaped); | 181 // install. |
| 182 if (irtPath_ != null) |
| 183 { |
| 184 string irtPathEscaped = irtPath_.Replace("\\", "\\\\"); |
| 185 contents.AppendFormat("nacl-irt \"{0}\"\n", irtPathEscaped); |
| 186 } |
| 187 |
| 167 contents.AppendFormat("target remote localhost:{0}\n", 4014); | 188 contents.AppendFormat("target remote localhost:{0}\n", 4014); |
| 168 | 189 |
| 169 // Insert breakpoints from Visual Studio project. | 190 // Insert breakpoints from Visual Studio project. |
| 170 if (Dte.Debugger.Breakpoints != null) | 191 if (Dte.Debugger.Breakpoints != null) |
| 171 { | 192 { |
| 172 foreach (Breakpoint bp in Dte.Debugger.Breakpoints) | 193 foreach (Breakpoint bp in Dte.Debugger.Breakpoints) |
| 173 { | 194 { |
| 174 if (!bp.Enabled) | 195 if (!bp.Enabled) |
| 175 { | 196 { |
| 176 continue; | 197 continue; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 207 gdbProcess_.Start(); | 228 gdbProcess_.Start(); |
| 208 } | 229 } |
| 209 catch (Exception e) | 230 catch (Exception e) |
| 210 { | 231 { |
| 211 MessageBox.Show( | 232 MessageBox.Show( |
| 212 string.Format("NaCl-GDB Start Failed. {0}. Path: {1}", e.Message, gd
bPath_)); | 233 string.Format("NaCl-GDB Start Failed. {0}. Path: {1}", e.Message, gd
bPath_)); |
| 213 } | 234 } |
| 214 } | 235 } |
| 215 } | 236 } |
| 216 } | 237 } |
| OLD | NEW |