77
* Creating the custom attributes themselves could modify the behavior of the
78
* debuggee, so we return objects similar to the CustomAttributeData objects
79
* used by the reflection-only functionality on .net.
80
* Since protocol version 2.21
82
public CustomAttributeDataMirror[] GetCustomAttributes (bool inherit) {
83
return GetCAttrs (null, inherit);
86
/* Since protocol version 2.21 */
87
public CustomAttributeDataMirror[] GetCustomAttributes (TypeMirror attributeType, bool inherit) {
88
if (attributeType == null)
89
throw new ArgumentNullException ("attributeType");
90
return GetCAttrs (attributeType, inherit);
93
CustomAttributeDataMirror[] GetCAttrs (TypeMirror type, bool inherit) {
94
if (cattrs == null && meta != null && !Metadata.HasCustomAttributes)
95
cattrs = new CustomAttributeDataMirror [0];
97
// FIXME: Handle inherit
99
CattrInfo[] info = vm.conn.Method_GetCustomAttributes (id, 0, false);
100
cattrs = CustomAttributeDataMirror.Create (vm, info);
102
var res = new List<CustomAttributeDataMirror> ();
103
foreach (var attr in cattrs)
104
if (type == null || attr.Constructor.DeclaringType == type)
106
return res.ToArray ();
75
109
MethodInfo GetInfo () {
77
111
info = vm.conn.Method_GetInfo (id);
207
241
public LocalVariable[] GetLocals () {
208
242
if (locals == null) {
210
243
LocalsInfo li = new LocalsInfo ();
212
245
li = vm.conn.Method_GetLocalsInfo (id);
213
246
} catch (CommandException) {
214
throw new ArgumentException ("Method doesn't have a body.");
247
throw new AbsentInformationException ();
216
250
// Add the arguments as well
217
251
var pi = vm.conn.Method_GetParamInfo (id);
249
283
if (body == null) {
250
284
MethodBodyInfo info = vm.conn.Method_GetBody (id);
252
body = new MethodBodyMirror (vm, this, info.il);
286
body = new MethodBodyMirror (vm, this, info);
303
337
var line_numbers = LineNumbers;
304
338
IList<Location> res = new Location [ILOffsets.Count];
305
339
for (int i = 0; i < il_offsets.Count; ++i)
306
res [i] = new Location (vm, this, -1, il_offsets [i], debug_info.source_files [i].source_file, line_numbers [i], 0, debug_info.source_files [i].hash);
340
res [i] = new Location (vm, this, -1, il_offsets [i], debug_info.source_files [i].source_file, line_numbers [i], debug_info.column_numbers [i], debug_info.source_files [i].hash);
309
343
return locations;
313
internal int il_offset_to_line_number (int il_offset, out string src_file, out byte[] src_hash) {
347
internal int il_offset_to_line_number (int il_offset, out string src_file, out byte[] src_hash, out int column_number) {
314
348
if (debug_info == null)
315
349
debug_info = vm.conn.Method_GetDebugInfo (id);
317
351
// FIXME: Optimize this
320
355
for (int i = debug_info.il_offsets.Length - 1; i >= 0; --i) {
321
356
if (debug_info.il_offsets [i] <= il_offset) {
322
357
src_file = debug_info.source_files [i].source_file;
323
358
src_hash = debug_info.source_files [i].hash;
359
column_number = debug_info.column_numbers [i];
324
360
return debug_info.line_numbers [i];