1 //
2 // Copyright (c) 2010-2018 Antmicro
3 // Copyright (c) 2011-2015 Realtime Embedded
4 //
5 // This file is licensed under the MIT License.
6 // Full license text is available in 'licenses/MIT.txt'.
7 //
8 using System;
9 using Antmicro.Renode.Logging;
10 using System.Linq;
11 using System.Collections.Generic;
12 using Antmicro.Renode.Debug;
13 using Antmicro.Renode.Peripherals.CPU;
14 
15 namespace Antmicro.Renode.Plugins.TracePlugin.Handlers
16 {
17     public class PrintfHandler : BaseFunctionHandler, IFunctionHandler
18     {
PrintfHandler(TranslationCPU cpu)19         public PrintfHandler(TranslationCPU cpu) : base(cpu)
20         {
21         }
22 
CallHandler(TranslationCPU cpu, ulong pc, string functionName, IEnumerable<object> arguments)23         public void CallHandler(TranslationCPU cpu, ulong pc, string functionName, IEnumerable<object> arguments)
24         {
25             Logger.LogAs(this, LogLevel.Warning, arguments.First().ToString());
26         }
27 
ReturnHandler(TranslationCPU cpu, ulong pc, string functionName, IEnumerable<object> argument)28         public void ReturnHandler(TranslationCPU cpu, ulong pc, string functionName, IEnumerable<object> argument)
29         {
30             throw new NotImplementedException();
31         }
32 
33         public IEnumerable<FunctionCallParameter> CallParameters
34         {
35             get
36             {
37                 return callParameters;
38             }
39         }
40 
41         public FunctionCallParameter? ReturnParameter
42         {
43             get
44             {
45                 return null;
46             }
47         }
48 
49         private static readonly IEnumerable<FunctionCallParameter> callParameters = new []{ new FunctionCallParameter{ Type = FunctionCallParameterType.String } };
50     }
51 }
52 
53