Top Banner
87

Supporting Parallel Component Debugging Using the GDB Python Interface

Dec 18, 2014

Download

Technology

wazari972

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

STMicroelectronicsLIGUniversity of Grenoble

Supporting Parallel Component Debugging

in Embedded Systems

Using GDB Python Interfaces.

Kevin Pouget, Miguel Santana, Vania Marangozova-Martinand Jean-François Mehaut

GNU Tools Cauldron 2012, July 9th -11th

Slide 1/29

Page 2: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Context

Embedded System Development

• High-resolution multimedia app. ⇒ high performance expectations.• H.265 HEVC• augmented reality,• . . .

• Sharp time-to-market constraints

⇒ Important demand for• powerful parallel architectures

• MultiProcessor on Chip (MPSoC)

• convenient programming methodologies

• Component-Based Software Engineering

• e�cient veri�cation and validation tools

• Our problematic

Slide 2/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 3: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Context

MultiProcessor on Chip (MPSoC)

• Parallel architecture• more di�cult to program

• Maybe heterogeneous• hardware accelerators,• GPU-like accelerators (OS-less)

• Embedded system• constrained environment,• on-board debugging complicated→ performance debugging only

• limited-scale functional debugging on simulators

Slide 3/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 4: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Context

Component-Based Software Engineering

• Focus on design of independent building blocks

• Applications built with interconnected components

• Allows the adaptation of the application architecture according toruntime constraints

• Runnable components able to exploit MPSoC parallelism

Slide 4/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 5: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Agenda

1 Component Debugging Challenges

2 Component-Aware Interactive Debugging

3 Feature Details

4 Python Implementation

5 Conclusion

Slide 5/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 6: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Agenda

1 Component Debugging Challenges

2 Component-Aware Interactive Debugging

3 Feature Details

4 Python Implementation

5 Conclusion

Slide 6/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 7: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Component-based applications are dynamic

• various set of components deployed during the execution

• components are dynamically inter-connected

Slide 7/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 8: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Component-based applications are dynamic

• various set of components deployed during the execution

• components are dynamically inter-connected

Slide 7/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 9: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Component-based applications are dynamic

• various set of components deployed during the execution

• components are dynamically inter-connected

Slide 7/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 10: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Components interact with one another

• their execution is driven by interface communications

• complex framework-dependent steps between an interface call andits execution

Slide 8/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 11: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Components interact with one another

• their execution is driven by interface communications

• complex framework-dependent steps between an interface call andits execution

Slide 8/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 12: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Components interact with one another

• their execution is driven by interface communications

• complex framework-dependent steps between an interface call andits execution

Slide 8/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 13: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Components interact with one another

• their execution is driven by interface communications

• complex framework-dependent steps between an interface call andits execution

Slide 8/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 14: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Components interact with one another

• their execution is driven by interface communications

• complex framework-dependent steps between an interface call andits execution

Slide 8/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 15: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Components interact with one another

• their execution is driven by interface communications

• complex framework-dependent steps between an interface call andits execution

Slide 8/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 16: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Components interact with one another

• their execution is driven by interface communications

• complex framework-dependent steps between an interface call andits execution

Slide 8/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 17: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Components interact with one another

• their execution is driven by interface communications

• complex framework-dependent steps between an interface call andits execution

Slide 8/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 18: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Information �ows over the components

• a corrupted data may be carried over various component beforetriggering a visible error

Slide 9/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 19: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Information �ows over the components

• a corrupted data may be carried over various component beforetriggering a visible error

Slide 9/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 20: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Information �ows over the components

• a corrupted data may be carried over various component beforetriggering a visible error

Slide 9/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 21: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Information �ows over the components

• a corrupted data may be carried over various component beforetriggering a visible error

Slide 9/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 22: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Information �ows over the components

• a corrupted data may be carried over various component beforetriggering a visible error

Slide 9/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 23: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component Debugging Challenges

Information �ows over the components

• a corrupted data may be carried over various component beforetriggering a visible error

Slide 9/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 24: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Agenda

1 Component Debugging Challenges

2 Component-Aware Interactive Debugging

3 Feature Details

4 Python Implementation

5 Conclusion

Slide 10/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 25: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive Debugging

Objective: Bring the debugger closer to the component model

• Show application architecture evolutions• component deployment• interface binding• . . .

• Follow the execution �ow(s) over the component graph• runnable component execution,• execution triggered by an interface call• . . .

• Track inter-component data exchanges• message route history,• message- or interface-based breakpoints• . . .

Slide 11/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 26: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive Debugging

Objective: Bring the debugger closer to the component model

• Show application architecture evolutions• component deployment• interface binding• . . .

• Follow the execution �ow(s) over the component graph• runnable component execution,• execution triggered by an interface call• . . .

• Track inter-component data exchanges• message route history,• message- or interface-based breakpoints• . . .

Slide 11/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 27: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive Debugging

Objective: Bring the debugger closer to the component model

• Show application architecture evolutions• component deployment• interface binding• . . .

• Follow the execution �ow(s) over the component graph• runnable component execution,• execution triggered by an interface call• . . .

• Track inter-component data exchanges• message route history,• message- or interface-based breakpoints• . . .

Slide 11/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 28: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive Debugging

Objective: Bring the debugger closer to the component model

• Show application architecture evolutions• component deployment• interface binding• . . .

• Follow the execution �ow(s) over the component graph• runnable component execution,• execution triggered by an interface call• . . .

• Track inter-component data exchanges• message route history,• message- or interface-based breakpoints• . . .

Slide 11/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 29: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 30: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 31: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 32: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 33: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 34: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 35: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 36: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 37: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 38: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 39: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 40: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 41: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 42: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 43: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 44: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Component-Aware Interactive DebuggingImplementation

⇒ Detect and interpret key events in the component framework

Slide 12/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 45: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Agenda

1 Component Debugging Challenges

2 Component-Aware Interactive Debugging

3 Feature Details

4 Python Implementation

5 Conclusion

Slide 13/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 46: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Feature DetailsProof-of-concept environment

Platform 2012

ST MPSoC research platform

• Heterogeneous

• 4x16 CPU OS-less comp. fabric

Slide 14/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 47: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Feature DetailsProof-of-concept environment

Native Programming Model

• P2012 component framework

• Provides communicationcomponents and interface

Platform 2012

ST MPSoC research platform

• Heterogeneous

• 4x16 CPU OS-less comp. fabric

Slide 14/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 48: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Feature DetailsProof-of-concept environment

The Gnu Debugger

• Adapted to low level debugging

• Large user community

Native Programming Model

• P2012 component framework

• Provides communicationcomponents and interface

Platform 2012

ST MPSoC research platform

• Heterogeneous

• 4x16 CPU OS-less comp. fabric

Slide 14/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 49: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Feature DetailsProof-of-concept environment

The Gnu Debugger

• Adapted to low level debugging

• Large user community

Native Programming Model

• P2012 component framework

• Provides communicationcomponents and interface

Platform 2012

ST MPSoC research platform

• Heterogeneous

• 4x16 CPU OS-less comp. fabric

Slide 14/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 50: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Feature DetailsCase study: Debugging a Pyramidal Feature Tracker

• part of an augmented realityapplication

• analyzes video frames to trackinteresting features motion

Slide 15/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 51: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerList components and their interfaces

(gdb) info component +connections

#1 Host[31272]

DMAPush/0x... <DMA> srcPullBuffer Component... #2

DMAPull/0x... <DMA> dstPushBuffer Component... #2

* #2 Component[SmoothAndSampleProcessor.so]

srcPullBuffer <DMA> DMAPush/0x... Host[31272]

dstPullBuffer <DMA> DMAPull/0x... Host[31272]

Slide 16/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 52: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 53: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 54: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 55: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Component B::Interface B.1 # Message received

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 56: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Component B::Interface B.1 # Message received

Message 2:

Component B # Message created

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 57: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Component B::Interface B.1 # Message received

Message 2:

Component B # Message created

Component B::Interface B.2 # Message sent

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 58: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Component B::Interface B.1 # Message received

Message 2:

Component B # Message created

Component B::Interface B.2 # Message sent

Component C::Interface C.1 # Message received

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 59: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Component B::Interface B.1 # Message received

Message 2:

Component B # Message created

Component B::Interface B.2 # Message sent

Component C::Interface C.1 # Message received

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 60: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Component B::Interface B.1 # Message received

Message 2:

Component B # Message created

Component B::Interface B.2 # Message sent

Component C::Interface C.1 # Message received

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 61: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about messages

• messages can be logically aggregated with user-de�ned routing tables:

Message 1:

Component A # Message created

Component A::Interface A.1 # Message sent

Component B::Interface B.1 # Message received

Component B::Interface B.2 # Message sent

Component C::Interface C.1 # Message received

Slide 17/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 62: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about interface activity

(gdb) info components +counts

#2 CommComponent[SmoothAndSampleProcessor.so]

srcPullBuffer #35 msgs

dstTmpPushBuffer #36 msgs

srcTmpPullBuffer #35 msgs

dstPushBuffer #34 msgs

• allowed us to �nd a bug in the application(msg sent to the wrong interface)

Slide 18/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 63: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about interface activity

(gdb) info components +counts

#2 CommComponent[SmoothAndSampleProcessor.so]

srcPullBuffer #35 msgs

dstTmpPushBuffer #36 msgs

srcTmpPullBuffer #35 msgs

dstPushBuffer #34 msgs

• allowed us to �nd a bug in the application(msg sent to the wrong interface)

Slide 18/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 64: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Case study: Debugging a Pyramidal Feature TrackerInformation about interface activity

Excerpt from a 300 lines-of-code �le

/* Compute last lines if necessary */

if (tmp_size > 0) {

...

/* Transmit the last lines computed */

CALL(srcTmpPullBuffer, release)(...);

CALL(dstTmpPushBuffer, push)(...);

}

Slide 19/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 65: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Agenda

1 Component Debugging Challenges

2 Component-Aware Interactive Debugging

3 Feature Details

4 Python Implementation

5 Conclusion

Slide 20/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 66: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python Implementation

Detect and Interpret Key Events in the Component Framework

Detect • Internal breakpoints• no apparent execution stop• no screen noti�cation

→ Python noti�cation for framework events

Key Events • New components, new binding• Component execution trigger• Message created, sent, received, . . .

Interpret • Debug information (DWARF)• API + Calling conventions→ (almost) everything we need

Slide 21/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 67: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python Implementation

Detect and Interpret Key Events in the Component Framework

Detect • Internal breakpoints• no apparent execution stop• no screen noti�cation

→ Python noti�cation for framework events

Key Events • New components, new binding• Component execution trigger• Message created, sent, received, . . .

Interpret • Debug information (DWARF)• API + Calling conventions→ (almost) everything we need

Slide 21/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 68: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python Implementation

Detect and Interpret Key Events in the Component Framework

Detect • Internal breakpoints• no apparent execution stop• no screen noti�cation

→ Python noti�cation for framework events

Key Events • New components, new binding• Component execution trigger• Message created, sent, received, . . .

Interpret • Debug information (DWARF)• API + Calling conventions→ (almost) everything we need

Slide 21/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 69: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python Implementation

Detect and Interpret Key Events in the Component Framework

Detect • Internal breakpoints• no apparent execution stop• no screen noti�cation

→ Python noti�cation for framework events

Key Events • New components, new binding• Component execution trigger• Message created, sent, received, . . .

Interpret • Debug information (DWARF)• API + Calling conventions→ (almost1) everything we need

1some implementation-dependent bits still remain ...

Slide 21/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 70: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationDebug Toolbox

Function breakpoints

Internal breakpoints triggered at the execution of a function⇒ catch input, updated and output parameters• stop, do_after, data = prepare_before(self)• stop = prepare_after(self, data)

• gdb.execute(�finish�)

�Thou shalt not alter the execution state of the inferior�(gdbdoc 23,2,2,20)

→ gdb.FinishBreakpoint instead

NPM_instantiateComponent(&cmp1_handle, type1, nb_procs);

NPM_instantiateComponent(&cmp2_handle, type2, nb_procs);

NPM_instantiateFIFOBuffer(&fifo_handle,

cmp1_handle, "src_itf",

cmp2_handle, "dst_itf");

...

Slide 22/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 71: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationDebug Toolbox

Function breakpoints

Internal breakpoints triggered at the execution of a function⇒ catch input, updated and output parameters• stop, do_after, data = prepare_before(self)• stop = prepare_after(self, data)

• gdb.execute(�finish�)

�Thou shalt not alter the execution state of the inferior�(gdbdoc 23,2,2,20)

→ gdb.FinishBreakpoint instead

NPM_instantiateComponent(&cmp1_handle, type1, nb_procs);

NPM_instantiateComponent(&cmp2_handle, type2, nb_procs);

NPM_instantiateFIFOBuffer(&fifo_handle,

cmp1_handle, "src_itf",

cmp2_handle, "dst_itf");

...

Slide 22/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 72: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationDebug Toolbox

Function breakpoints

Internal breakpoints triggered at the execution of a function⇒ catch input, updated and output parameters• stop, do_after, data = prepare_before(self)• stop = prepare_after(self, data)

• gdb.execute(�finish�)

�Thou shalt not alter the execution state of the inferior�(gdbdoc 23,2,2,20)

→ gdb.FinishBreakpoint instead

NPM_instantiateComponent(&cmp1_handle, type1, nb_procs);

NPM_instantiateComponent(&cmp2_handle, type2, nb_procs);

NPM_instantiateFIFOBuffer(&fifo_handle,

cmp1_handle, "src_itf",

cmp2_handle, "dst_itf");

...Slide 22/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 73: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationDebug Toolbox

User-level Multithreading

• threading implemented with longjmp/setjmp

→ invisible to GDB

REGISTERS = ("$esp", "$ebp", "$eip") # $

def save_current_thread():

return [gdb.parse_and_eval(reg) for reg in REGISTERS]

def switch_inactive_thread(next_):

jmbuf = next_["context"][0]["__jmpbuf"]

gdb.execute("set $esp=%s" % jmbuf[JB_SP])

gdb.execute("set $ebp=%s" % jmbuf[JB_BP])

gdb.execute("set $eip=__longjmp")

gdb.execute("flushregs")

def reload_current_thread(stop_regs):

for reg_name, reg_val in map(REGISTERS, stop_regs):

gdb.execute("set %s=%s" % (reg_name, str(reg_val))

Slide 23/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 74: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

REGISTERS = ("$esp", "$ebp", "$eip") # $

def save_current_thread():

return [gdb.parse_and_eval(reg) for reg in REGISTERS]

def switch_inactive_thread(next_):

jmbuf = next_["context"][0]["__jmpbuf"]

gdb.execute("set $esp=%s" % jmbuf[JB_SP])

gdb.execute("set $ebp=%s" % jmbuf[JB_BP])

gdb.execute("set $eip=__longjmp")

gdb.execute("flushregs")

def reload_current_thread(stop_regs):

for reg_name, reg_val in map(REGISTERS, stop_regs):

gdb.execute("set %s=%s" % (reg_name, str(reg_val))

Slide 23/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 75: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

REGISTERS = ("$esp", "$ebp", "$eip") # $

def save_current_thread():

return [gdb.parse_and_eval(reg) for reg in REGISTERS]

def switch_inactive_thread(next_):

jmbuf = next_["context"][0]["__jmpbuf"]

gdb.execute("set $esp=%s" % jmbuf[JB_SP])

gdb.execute("set $ebp=%s" % jmbuf[JB_BP])

gdb.execute("set $eip=__longjmp")

gdb.execute("flushregs")

def reload_current_thread(stop_regs):

for reg_name, reg_val in map(REGISTERS, stop_regs):

gdb.execute("set %s=%s" % (reg_name, str(reg_val))

Slide 23/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 76: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

REGISTERS = ("$esp", "$ebp", "$eip") # $

def save_current_thread():

return [gdb.parse_and_eval(reg) for reg in REGISTERS]

def switch_inactive_thread(next_):

jmbuf = next_["context"][0]["__jmpbuf"]

gdb.execute("set $esp=%s" % jmbuf[JB_SP])

gdb.execute("set $ebp=%s" % jmbuf[JB_BP])

gdb.execute("set $eip=__longjmp")

gdb.execute("flushregs")

def reload_current_thread(stop_regs):

for reg_name, reg_val in map(REGISTERS, stop_regs):

gdb.execute("set %s=%s" % (reg_name, str(reg_val))

Slide 23/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 77: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationDebug Toolbox

User-level Multithreading

(gdb) info processors

#1 Processor DMA 1 // user-level threads

#2 Processor 1 Cluster 1 // <=> simulated processors

* #3 Processor 2 Cluster 1

#4 Processor 1 Cluster 2

...

(gdb) info components

#1 Host // component not scheduled

* #2 Component A1 // current component

#3 Component A2

~ #4 Component B1 // component not schedulable

~ #5 Component B2 // <=> no execution context

Slide 24/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 78: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationDebug Toolbox

User-level Multithreading

(gdb) component 3

[Switching to sleeping Component A2 #3]

(gdb) where

#0 0x47bb07a0 in __longjmp () from /usr/lib/libc.so.6

#1 0xf7fe3f20 in contextSwitch (old, new)

#2 0xf7fe406d in schedule_next_execution_context ()

#3 0xe7eb7838 in schedNext ()

...

#9 0xdd55e23d in outputBuffer_fetchNextBuffer (...)

#10 0xdd5d26c8 in rtmMaster (...)

#11 0xdd5d307d in thread_main (...)

...

Slide 25/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 79: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationDebug Toolbox

User-level Multithreading

• far from being perfect• no coordination with GDB thread capabilities

• user-level thread debugging is possible with Python

• a Thread_db library (e.g., User-Level Thread_db2) could make itmore standard and reliable

2ULDB: a debugging API for user-level thread libraries, K. Pouget et al, MTAAP 10

Slide 26/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 80: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationEntity Tracking

On framework function breakpoint:

1 identify operation and parameters• which function?gdb.Breakpoint.location

• API for parameters• cmp_py = lookup_table[handle]

2 identify active component• based on current thread/processor

3 update internal state accordingly, e.g.,• create a component/link object• move a message btw components• . . .

4 check user breakpoints/catchpoint

Slide 27/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 81: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationEntity Tracking

On framework function breakpoint:

1 identify operation and parameters• which function?gdb.Breakpoint.location

• API for parameters• cmp_py = lookup_table[handle]

2 identify active component• based on current thread/processor

3 update internal state accordingly, e.g.,• create a component/link object• move a message btw components• . . .

4 check user breakpoints/catchpoint

Slide 27/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 82: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationEntity Tracking

On framework function breakpoint:

1 identify operation and parameters• which function?gdb.Breakpoint.location

• API for parameters• cmp_py = lookup_table[handle]

2 identify active component• based on current thread/processor

3 update internal state accordingly, e.g.,• create a component/link object• move a message btw components• . . .

4 check user breakpoints/catchpoint

Slide 27/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 83: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Python ImplementationEntity Tracking

On framework function breakpoint:

1 identify operation and parameters• which function?gdb.Breakpoint.location

• API for parameters• cmp_py = lookup_table[handle]

2 identify active component• based on current thread/processor

3 update internal state accordingly, e.g.,• create a component/link object• move a message btw components• . . .

4 check user breakpoints/catchpoint

Slide 27/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 84: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Agenda

1 Component Debugging Challenges

2 Component-Aware Interactive Debugging

3 Feature Details

4 Python Implementation

5 Conclusion

Slide 28/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 85: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Conclusion

• Debugging dynamic component application is challenging

• Lack of high level information about components framework

• Our work: bring debuggers closer to the component model• better understanding application behavior• keep focused on bug tracking

• Proof-of-concept: GDB and its Python interface• interface good enough to build real improvements in Python• a few missing bits contributed to the project

• gdb.FinishBreakpoint• multiple breakpoint hits• gdb.selected_inferior()

• Going further programming-model aware debugging• OpenCL• Data�ow execution model• . . .

Slide 29/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 86: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Conclusion

• Debugging dynamic component application is challenging

• Lack of high level information about components framework

• Our work: bring debuggers closer to the component model• better understanding application behavior• keep focused on bug tracking

• Proof-of-concept: GDB and its Python interface• interface good enough to build real improvements in Python• a few missing bits contributed to the project

• gdb.FinishBreakpoint• multiple breakpoint hits• gdb.selected_inferior()

• Going further programming-model aware debugging• OpenCL• Data�ow execution model• . . .

Slide 29/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th

Page 87: Supporting Parallel Component Debugging Using the GDB Python Interface

stm icroelectron i c s , un i ver s i ty of grenoble/l ig laboratory

Conclusion

• Debugging dynamic component application is challenging

• Lack of high level information about components framework

• Our work: bring debuggers closer to the component model• better understanding application behavior• keep focused on bug tracking

• Proof-of-concept: GDB and its Python interface• interface good enough to build real improvements in Python• a few missing bits contributed to the project

• gdb.FinishBreakpoint• multiple breakpoint hits• gdb.selected_inferior()

• Going further programming-model aware debugging• OpenCL• Data�ow execution model• . . .

Slide 29/29 � [email protected] � Supporting Parallel Component Debugging. � GNU Tools Cauldron 2012, July 9th -11th