public ReadMemoryRH(ReadMemoryDelegate readMemory, byte[] buffer, UInt64 size, GDBSubProcess gdbProc) : base(gdbProc) { _readMemory = readMemory; _buffer = buffer; //_size = size; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { Regex rOutOfRange = new Regex (@"\s*Line number \S* is out of range[\s*\S*]*", RegexOptions.Compiled | RegexOptions.IgnoreCase); //Regex rAddress = new Regex (@"\s*Line \S* of [\s*\S*]* \S* at address 0x(?<address>\S*) [\s*\S*]*", RegexOptions.Compiled | RegexOptions.IgnoreCase); Regex rAddress = new Regex (@"[\s*\S*]*at address 0x(?<address>\S*) [\s*\S*]*", RegexOptions.Compiled | RegexOptions.IgnoreCase); foreach (string line in responseLines) { Console.WriteLine("Handling ResponseLine: {0}", line); if (rOutOfRange.Match (line).Success) { _addressResolved (_lineArg, null); return GDBResponseHandler.HandleResponseEnum.Handled; //continue; } Match m = rAddress.Match (line); if (m.Success) { UInt64 address; if (UInt64.TryParse (m.Result ("${address}"), NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo, out address)) _addressResolved (_lineArg, new StaticAddress (address)); else _addressResolved (_lineArg, null); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.RequestLine; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { Regex fileRead = new Regex(@"Reading symbols from [\S*\s*]*", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex fileNotFound = new Regex(@"[\S*\s*]*: No such file or directory.\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); for(int i = 0; i<responseLines.Length ; i++) { string line = responseLines[i]; Match m = fileNotFound.Match(line); if(m.Success) { _fileLoaded(false); return GDBResponseHandler.HandleResponseEnum.Handled; } m = fileRead.Match(line); if(m.Success) { _fileLoaded(true); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { if (allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; Regex rWithFile = new Regex (@"Breakpoint\s*(?<num>\d+)\s*at\s*0x(?<at>\S*):[\s*\S*]*", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rWithoutFile = new Regex (@"Breakpoint\s*(?<num>\d+)\s*at\s*0x(?<at>\S*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); foreach (string line in responseLines) { Match m = rWithFile.Match (line); if (m.Success) { _cb (int.Parse (m.Result ("${num}")), UInt64.Parse (m.Result ("${at}"), NumberStyles.HexNumber)); return GDBResponseHandler.HandleResponseEnum.Handled; } m = rWithoutFile.Match (line); if (m.Success) { _cb (int.Parse (m.Result ("${num}")), UInt64.Parse (m.Result ("${at}"), NumberStyles.HexNumber)); return GDBResponseHandler.HandleResponseEnum.Handled; } } //Undefined response _cb (null, 0); return GDBResponseHandler.HandleResponseEnum.Handled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { //Request as many lines as available if(allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; Regex rFile = new Regex(@"File\s*(?<filename>[\s*\S*]*)\:", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rMethodWithDebuggingInfo = new Regex(@"(?<returntype>\S*)\s*(?<method>\S*)\([\s*\S*]*\);", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rNoDebugInfo = new Regex(@"Non-debugging symbols:", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rMethodNoDebuggingInfo = new Regex(@"0x(?<at>\S*)\s*(?<method>\S*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); bool debuggingInfo = false; //string lastFile = ""; List<ISymbolTableMethod> resolvedFunctions = new List<ISymbolTableMethod>(); List<ISymbolTableMethod> unresolvedfunctions = new List<ISymbolTableMethod>(); for(int i = 0; i<responseLines.Length ; i++) { string line = responseLines[i]; Match mHeaderFile = rFile.Match(line); //We got a File header, this means we got debugging information if(mHeaderFile.Success) { //lastFile = mHeaderFile.Result("${filename}"); debuggingInfo = true; continue; } Match mNoDebugInfo = rNoDebugInfo.Match(line); //We got linker debugging methods if(mNoDebugInfo.Success) { //lastFile = ""; debuggingInfo = false; continue; } Match mMethodWithDebuggingInfo = rMethodWithDebuggingInfo.Match(line); if(debuggingInfo && mMethodWithDebuggingInfo.Success) { unresolvedfunctions.Add(new SymbolTableMethod(_symbolTable, mMethodWithDebuggingInfo.Result("${method}"), null)); continue; } Match mMethodNoDebuggingInfo = rMethodNoDebuggingInfo.Match(line); if(!debuggingInfo && mMethodNoDebuggingInfo.Success) { resolvedFunctions.Add(new SymbolTableMethod(_symbolTable, mMethodNoDebuggingInfo.Result("${method}"), null)); continue; } } _functionsIdentifier(resolvedFunctions.ToArray(), unresolvedfunctions.ToArray()); return GDBResponseHandler.HandleResponseEnum.Handled; }
/// <summary> /// Constructs a new break command /// </summary> /// <param name="address">Address to set a breakpoint at. Use Symbol Table to translate named symbols to addresses</param> public SetBreakpointCmd(UInt64 address, SetBreakpointRH.SetBreakpointDelegate rhCb, GDBSubProcess gdbProc) : base(gdbProc) { _address = address; _rh = new SetBreakpointRH(rhCb, _gdbProc); }
public InfoLineCmd(GDBSubProcess gdbProc, string lineArg, InfoLineRH.AddressResolvedCB cb) : base(gdbProc) { _lineArg = lineArg; _rh = new InfoLineRH (gdbProc,lineArg, cb); }
public RestoreCmd(string filename, UInt64 address, GDBSubProcess gdbProc) : base(gdbProc) { _file = filename; _address = address; _rh = new RestoreRH (gdbProc); }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { if (allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; Regex r = new Regex (@"\S*:\s*(?<varname>\S*)\s*=\s*(?<value>\S*)", RegexOptions.Compiled | RegexOptions.IgnoreCase); Dictionary<string, string> discoveredVariables = new Dictionary<string, string> (); foreach (string line in responseLines) { Match m = r.Match (line); if (m.Success) { string varName = m.Result ("${varname}"); string value = m.Result ("${value}"); if (discoveredVariables.ContainsKey (varName)) discoveredVariables[varName] = value; else discoveredVariables.Add (varName, value); } } _cb (discoveredVariables); return GDBResponseHandler.HandleResponseEnum.Handled; }
public TargetCmd(string targetSpecifier, Action<bool> connectionStatusCb, GDBSubProcess gdbProc) : base(gdbProc) { _targetSpecifier = targetSpecifier; _responseHandler = new TargetRH(connectionStatusCb, _gdbProc); }
/// <summary> /// Constructs a new break command /// </summary> /// <param name="breakSymbol">Symbol to break at</param> public SetBreakpointNameCmd(ISymbol breakSymbol, SetBreakpointRH.SetBreakpointDelegate rhCb, GDBSubProcess gdbProc) : base(gdbProc) { _breakSymbol = breakSymbol; _rh = new SetBreakpointRH(rhCb, _gdbProc); }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { if (allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; return GDBResponseHandler.HandleResponseEnum.Handled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { if (allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; Regex rHeader = new Regex (@"Name\s*Nr\s*Rel\s*Offset\s*Size\s*Type\s*\Raw value\s*", RegexOptions.Compiled | RegexOptions.IgnoreCase); Regex rRegisterLine = new Regex (@"\s*(?<regname>\S*)\s*(?<regnum>\S*)\s*(?<regrel>\S*)\s*(?<regoffset>\S*)\s*(?<regsize>\S*)\s*(?<regtype>\S*)\s*(?<regvalue>\S*)", RegexOptions.Compiled | RegexOptions.IgnoreCase); foreach (string line in responseLines) { Match m = rHeader.Match (line); if (m.Success) continue; m = rRegisterLine.Match (line); if (m.Success) { uint regnum; uint regsize; if (uint.TryParse (m.Result ("${regnum}"), out regnum) == false || uint.TryParse (m.Result ("${regsize}"), out regsize) == false) continue; _registerDiscovery (m.Result ("${regname}"), regnum, regsize); } } return GDBResponseHandler.HandleResponseEnum.Handled; }
public PrintCmd(Format format, string expression, Action<object> callback, GDBSubProcess gdbProc) : base(gdbProc) { _format = format; _expression = expression; _rh = new PrintRH(format, callback, _gdbProc); }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { if (allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; Regex rError = new Regex (@"0x[\s*\S*]*:\s*Cannot access memory at address[\s*\S*]*", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rSuccess = new Regex (@"0x[\s*\S*]*:\s*(?<values>[\s*\S*]*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); UInt64 readBytes = 0; foreach (string responseLine in responseLines) { if (readBytes >= (UInt64)_buffer.Length) break; if (rError.Match (responseLine).Success) break; Match m = rSuccess.Match (responseLine); try { if (m.Success) { string values = m.Result ("${values}").Trim (); string[] splittedValues = values.Split ('\t'); foreach (string v in splittedValues) { if (readBytes >= (UInt64)_buffer.Length) break; if (!v.StartsWith ("0x")) break; try { _buffer[readBytes] = Byte.Parse (v.Substring (2), NumberStyles.HexNumber); } catch (Exception) { //Byte.TryParse does not work, for whatever reason.....maybe something wrong with mono implementation? continue; } readBytes++; } } } catch(Exception) { } } _readMemory(readBytes, _buffer); return GDBResponseHandler.HandleResponseEnum.Handled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { if(responseLines.Length == 0) return GDBResponseHandler.HandleResponseEnum.Handled; _logger.WarnFormat("Got {0} unhandled response lines:", responseLines.Length); foreach(string responseLine in responseLines) _logger.Warn(responseLine); return GDBResponseHandler.HandleResponseEnum.Handled; }
public ReadMemoryCmd(UInt64 address, UInt64 size, byte[] buffer, ReadMemoryRH.ReadMemoryDelegate readMemory, GDBSubProcess gdbProc) : base(gdbProc) { if((UInt64)buffer.Length < size) throw new ArgumentException("Buffer too small"); _address = address; _size = size; _buffer = buffer; _rh = new ReadMemoryRH(readMemory, _buffer, _size, _gdbProc); }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { Regex r = new Regex(@"0x(?<address>\S*):[\s*\S*]*"); Match m = r.Match(responseLines[0]); if(m.Success) _symbolResolved(_s, new StaticAddress(UInt64.Parse(m.Result("${address}"), NumberStyles.HexNumber))); else _symbolResolved(_s, null); return GDBResponseHandler.HandleResponseEnum.Handled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { Regex r = new Regex(@"Program received signal (?<signal_name>\S*),\s*(?<friendly_signal_name>[\S*\s*]*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rAddress = new Regex(@"0x(?<at>\S*)\s*in[\S*\s*]*"); for(int i = 0; i<responseLines.Length ; i++) { string line = responseLines[i]; Match match = r.Match(line); if(match.Success) { UInt64? address = null; //Request another line if the address is not included yet if(i + 1 == responseLines.Length && allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; //Iterate through all other response lines and look for an address line for(int addressLineNum = i+1 ; addressLineNum<responseLines.Length;addressLineNum++) { Match addressMatch = rAddress.Match(responseLines[addressLineNum]); if(addressMatch.Success) { address = UInt64.Parse(addressMatch.Result("${at}"), NumberStyles.HexNumber); break; } } //If no address line is present, try to request another line, //otherwise give up...no address is available if(address == null && allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; string signal = match.Result("${signal_name}"); object oSignal = Enum.Parse(typeof(SignalEnum), signal, true); SignalEnum eSignal = SignalEnum.UNKNOWN; if(oSignal != null) eSignal = (SignalEnum)oSignal; _gdbStopped(StopReasonEnum.Terminated, null, address == null?0:address.Value, (int)eSignal); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { Regex r = new Regex (@"Attaching to program: (?<file>[\s*\S*]*), process (?<process_id>\S*)"); foreach (string line in responseLines) { Match m = r.Match (line); if (m.Success) { _cb (m.Result ("${file}")); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { if (allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; Regex r; //if(_format == PrintCmd.Format.Hex) // r = new Regex(@"[\s*\S*]*=\s*0x(?<at>\S*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); //else r = new Regex (@"[\s*\S*]*=\s*(?<value>[\s*\S*]*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rNoRegisters = new Regex (@"No registers", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rNoSymbol = new Regex ("No symbol \"(?<symbol_name>\\S*)\" in current context.", RegexOptions.IgnoreCase | RegexOptions.Compiled); for (int i = 0; i < responseLines.Length; i++) { string line = responseLines[i]; Match match = r.Match (line); if (match.Success) { string value = match.Result ("${value}"); if (_format == PrintCmd.Format.Hex && value.Trim ().StartsWith ("0x")) _callback (UInt64.Parse (value.Trim ().Substring (2), NumberStyles.HexNumber)); else _callback (match.Result ("${value}")); return GDBResponseHandler.HandleResponseEnum.Handled; } if (rNoRegisters.Match (line).Success) { _callback (null); return GDBResponseHandler.HandleResponseEnum.Handled; } if (rNoSymbol.Match (line).Success) { _callback (null); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { Regex r = new Regex(@"No more reverse-execution history.\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rAddress = new Regex(@"0x(?<at>\S*)\s*in[\S*\s*]*"); for(int i = 0; i<responseLines.Length ; i++) { string line = responseLines[i]; Match match = r.Match(line); if(match.Success) { UInt64? address = null; //Request another line if the address is not included yet if(i + 1 == responseLines.Length && allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; //Iterate through all other response lines and look for an address line for(int addressLineNum = i+1 ; addressLineNum<responseLines.Length;addressLineNum++) { Match addressMatch = rAddress.Match(responseLines[addressLineNum]); if(addressMatch.Success) { address = UInt64.Parse(addressMatch.Result("${at}"), NumberStyles.HexNumber); break; } } //If no address line is present, try to request another line, //otherwise give up...no address is available if(address == null && allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; _gdbStopped(StopReasonEnum.Breakpoint, address == null ? null : _connector.LookupBreakpointByAddress(address.Value), address == null ? 0 : address.Value, 0); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { foreach(string line in responseLines) { if(line.Trim().StartsWith("remote debugging using", StringComparison.InvariantCultureIgnoreCase)) { _connectionStatusCb(true); return GDBResponseHandler.HandleResponseEnum.Handled; } else if(line.Trim().EndsWith("unknown host", StringComparison.InvariantCultureIgnoreCase)) { _connectionStatusCb(false); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { if (allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; Regex rNoLocals = new Regex (@"Scope for (?<symbol>\S*) contains no locals or arguments.", RegexOptions.Compiled | RegexOptions.IgnoreCase); Regex rUndefinedSymbol = new Regex (@"[\s*\S*]* not defined.", RegexOptions.Compiled | RegexOptions.IgnoreCase); Regex rHeader = new Regex (@"Scope for (?<symbol>\S*)", RegexOptions.Compiled | RegexOptions.IgnoreCase); Regex rVar = new Regex (@"Symbol (?<symbol>\S*) [\s*\S*]* length (?<length>\S*).", RegexOptions.Compiled | RegexOptions.IgnoreCase); List<ISymbol> discoveredSymbols = new List<ISymbol> (); List<int> discoveredLengths = new List<int> (); foreach (string line in responseLines) { Match m = rNoLocals.Match (line); if (m.Success) break; m = rUndefinedSymbol.Match (line); if (m.Success) break; m = rHeader.Match (line); if (m.Success) { continue; } m = rVar.Match (line); if (m.Success) { discoveredSymbols.Add (new SimpleSymbol (m.Result ("${symbol}"))); int length = 0; Int32.TryParse (m.Result ("${length}"), out length); discoveredLengths.Add (length); } } _cb(discoveredSymbols.ToArray(), discoveredLengths.ToArray()); return GDBResponseHandler.HandleResponseEnum.Handled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { Regex rAddress = new Regex(@"Breakpoint\s*(?<num>\d+)\s*,\s*0x(?<at>\S*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); //Is there an option to tell GDB to always output the current pc on break? Regex rSymbol = new Regex(@"Breakpoint\s*(?<num>\d+)\s*,\s*(?<symbol>\S*)\s*\((?<args>[\s*\S*]*)\)\s*at\s*(?<file>[\S*\s*]*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); foreach(string line in responseLines) { Match m = rAddress.Match(line); if(m.Success) { int breakpointNum = int.Parse(m.Result("${num}")); GDBBreakpoint breakpoint = _connector.LookupBreakpoint(breakpointNum); if(breakpoint != null) { _gdbStopped(StopReasonEnum.Breakpoint, breakpoint, UInt64.Parse(m.Result("${at}"), NumberStyles.HexNumber), 0); } return GDBResponseHandler.HandleResponseEnum.Handled; } m = rSymbol.Match(line); if(m.Success) { int breakpointNum = int.Parse(m.Result("${num}")); GDBBreakpoint breakpoint = _connector.LookupBreakpoint(breakpointNum); if(breakpoint != null) { _gdbStopped(StopReasonEnum.Breakpoint, breakpoint, 0, 0); } return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { Regex r = new Regex (@"type = (?<return_type>\S*) \((?<parameters>[\s*\S*]*)\)", RegexOptions.Compiled | RegexOptions.IgnoreCase); Regex rNoDebugInfo = new Regex (@"type = (?<type>[\S*\s*]*)", RegexOptions.Compiled | RegexOptions.IgnoreCase); Regex rNoSymbol = new Regex (@"No symbol [\s*\S*]*", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (rNoSymbol.Match (responseLines[0]).Success) { _cb (_symbol, null, null); return GDBResponseHandler.HandleResponseEnum.Handled; } Match m = r.Match (responseLines[0]); if (m.Success) { string returnType = m.Result ("${return_type}"); string[] parameters = m.Result ("${parameters}").Split (','); List<string> realParameters = new List<string> (); foreach (string param in parameters) { string paramName = param.Trim (); if (!paramName.Equals (String.Empty)) realParameters.Add (paramName); } _cb (_symbol, returnType, realParameters.ToArray ()); return GDBResponseHandler.HandleResponseEnum.Handled; } else if (rNoDebugInfo.Match (responseLines[0]).Success) { _cb (_symbol, "", null); return GDBResponseHandler.HandleResponseEnum.Handled; } _cb (_symbol, "", null); return GDBResponseHandler.HandleResponseEnum.Handled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { if (allowRequestLine) return GDBResponseHandler.HandleResponseEnum.RequestLine; Regex rSavedRegisterStart = new Regex (@"[\s*\S*]*Saved registers:(?<reg_definitions>[\s*\S*]*)", RegexOptions.Compiled | RegexOptions.IgnoreCase); //Current parsing status, //The response may also come in a single line (new behaviour) // 0 ... Waiting for next "key-line" // 1 ... Reading Saved register addressed (appear after "Saved registers:" line) int status = 0; Dictionary<string, IAddressSpecifier> savedRegisters = new Dictionary<string, IAddressSpecifier> (); foreach (string line in responseLines) { if (status == 0) { Match savedRegMatch = rSavedRegisterStart.Match (line); if(savedRegMatch.Success) { status = 1; string regDefinitions = savedRegMatch.Result("${reg_definitions}"); if(regDefinitions != null && !regDefinitions.Equals(String.Empty)) { ParseSavedRegisterLine(regDefinitions, savedRegisters); } } } else if (status == 1) ParseSavedRegisterLine (line, savedRegisters); } _frameInfo (savedRegisters); return GDBResponseHandler.HandleResponseEnum.Handled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { Regex success = new Regex(@"\s*Starting program:\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex success_commit = new Regex(@"\s*The program being debugged has been started already.\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); foreach(string line in responseLines) { if(success.Match(line).Success) { _cb(true); return GDBResponseHandler.HandleResponseEnum.Handled; } else if(success_commit.Match(line).Success) { connector.QueueCommand(new SimpleCmd("y", this, _gdbProc)); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess connector, string[] responseLines, bool allowRequestLine) { Regex success = new Regex(@"\s*Continuing.\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex failure = new Regex(@"\s*The program is not being run.\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); foreach(string line in responseLines) { if(success.Match(line).Success) { _cb(true); return GDBResponseHandler.HandleResponseEnum.Handled; } else if(failure.Match(line).Success) { connector.QueueCommand(new RunCmd(_runArgs, _cb, _gdbProc)); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.NotHandled; }
public override GDBResponseHandler.HandleResponseEnum HandleResponse(GDBSubProcess subProcess, string[] responseLines, bool allowRequestLine) { Regex rStaticSymbol = new Regex("Symbol \"(?<symbol_name>\\S*)\"\\s*is\\s*(?<type>[\\S*\\s*]*) at address 0x(?<at>\\S*).", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rVariableSymbol = new Regex("Symbol \"(?<symbol_name>\\S*)\"\\s*is\\s*(?<type>[\\S*\\s*]*) at (?<reg_desc>[\\s*\\S*]*) \\$(?<reg_name>\\S*) offset (?<offset>[\\S*\\s*]*).", RegexOptions.IgnoreCase | RegexOptions.Compiled); Regex rNoSymbol = new Regex("No\\s*symbol\\s*\"(?<symbol_name>\\S*)\"\\s*in\\s*current\\s*context.", RegexOptions.IgnoreCase | RegexOptions.Compiled); for(int i = 0; i<responseLines.Length ; i++) { string line = responseLines[i]; Match mStatic = rStaticSymbol.Match(line); if(mStatic.Success) { _resolvedCallback(_symbol, new StaticAddress(UInt64.Parse(mStatic.Result("${at}"), NumberStyles.HexNumber))); return GDBResponseHandler.HandleResponseEnum.Handled; } Match mVariable = rVariableSymbol.Match(line); if(mVariable.Success) { _resolvedCallback(_symbol, new GDBRegisterBasedAddressSpecifier(mVariable.Result("${reg_name}"), mVariable.Result("${offset}"), _gdbProc)); return GDBResponseHandler.HandleResponseEnum.Handled; } Match mNoSymbol = rNoSymbol.Match(line); if(mNoSymbol.Success) { _resolvedCallback(_symbol, null); return GDBResponseHandler.HandleResponseEnum.Handled; } } return GDBResponseHandler.HandleResponseEnum.Handled; }