Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Debugger and Profiler 1

for Tizen .NET


Igor Kulaychuk
i.kulaychuk@samsung.com
Copyright © 2017 Samsung. All Rights Reserved.
About me

Igor Kulaychuk
•  Leading Software Engineer at Samsung R&D Institute Russia
•  Part of Tizen .NET team
2
•  Responsible for development of Debugger for Tizen .NET

Experience:
•  Development of testing and debugging tools for Android/Tizen
•  C/C++/Linux/ptrace
Outline

Visual Studio Tools for Tizen .NET


3

Debugger / Profiler
–  overview
–  demo
Application Development

C and EFL OR   HTML5 ?  


Tizen  .NET   4

•  Visual  Studio  integra5on  


•  Xamarin.Forms  
•  Tizen  Emulator  
•  .NET  Core  
•  Tizen  pla;orm-­‐specific  API  
Debugger

Visual App
Studio .NET Core 5

MIEngine sdb LLDB


Visual Studio integration https://github.com/Microsoft/MIEngine
Modified .NET Core https://github.com/dotnet/coreclr
Debugger is based on LLDB
Debugger Demo
•  Application: 1  2  Fizz  4  Buzz  …  14  FizzBuzz  16  
–  FizzBuzz (bug: prints “Buzz” on 15)

•  Debugging scenario: 6

–  Put breakpoint at the start of new list item generation code


–  Add condition currentNumber  ==  15  
–  Step through code and find where the bug occurs
7

Debugger demo

DEMO
Profiler

Visual App
Studio .NET Core 8

Profiler UI sdb LTTng


Visual Studio integration using custom profiler UI
Profiler is based on Linux Trace Toolkit Next Generation http://lttng.org
Profiler Demo
•  Application:
–  Run application under Profiler

•  Profiling scenario: 9

–  Observer CPU/Memory consumption in real time


–  View Profiler session file
–  View hot lines
10

Profiler demo

DEMO
11
Conclusion
Build, debug and profile your applications
using .NET with Visual Studio

•  Download at: 12

https://developer.tizen.org/

•  Contact me:
i.kulaychuk@samsung.com
https://github.com/ayuckhulk
13

Thank you!
14

Implementation details
Implementation details
Modify

Visual GDB   .NET


MIEngine sdb lldb-mi JIT   App
Studio Core
15
•  GDB/MI – line based text interface to debugger
•  MIEngine – open source Visual Studio MI Debug engine
(by Microsoft)
–  works with gdb, lldb, clrdbg
•  GDB JIT – provides the debugger info for code generated
at runtime
.NET Core modifications - DWARF
•  Generate ELF in memory with DWARF debug info
–  Line numbers
–  Local variables with scopes
–  Method arguments 16

–  Types
.NET Core modifications - GDBJIT
•  On method compilation
–  Generate ELF in memory
–  Trigger __jit_debug_register_code function
–  debugger consumes generated ELF from 17

__jit_debug_descriptor variable
LLDB – Why?
•  License
•  Relatively easy to add a new language
•  Supports different architectures
18
•  Has GDB/MI implementation
•  .NET Core has a plugin for inspecting runtime internals
LLDB - Stepping
•  ThreadPlan
try  
step-in {   internal void  SomeMethod()  
       SomeMethod();  
}   breakpoint {  
catch  (Exception  e)          DoSomething();   19
{   }  
       ShowError(e);  
}  

•  Method native code does not exist before it is called


•  Step-over for exceptions handlers are really step-in
LLDB – Data visualization
•  Formatters
–  Decimals, strings etc.
–  Display {MyClass}  instead of 0x0000FFFFF730966A etc.
20

•  Synthetics
–  Hide internal class variables (like _count  for arrays)
–  Show inherited fields like CLRDBG
21

Thank you!

You might also like