Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… ·...

45
Pedro Machado Supervisors: Rui Maranhão (PhD) José Campos (MSc) Automatic Debugging of Android Applications

Transcript of Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… ·...

Page 1: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Pedro Machado

Supervisors:

Rui Maranhão (PhD)

José Campos (MSc)

Automatic Debugging of

Android Applications

Page 2: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

“Context”

Page 3: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Context

3

Page 4: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Context

4

Page 5: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Context

5

Source: Gartner

Page 6: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Software Development Process

Design Implement Test Release

Debug

6

Page 7: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

“Challenges”

Page 8: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Debugging

Debugging

Time Money

8

Page 9: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Challenges

9

Debugging is a manual task

Resource constraints

Very specific architectures

Page 10: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Challenges

Are mobile apps…

… reliable?

10

Page 11: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Hypothesis

Static and dynamic analysis

improve the reliability of

Mobile Apps.

11

Page 12: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

“Related Work”

Page 13: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Android Debugging tools [6]

13

Page 14: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

GROPG [3]

14

Page 15: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Fault localization tools

Gzoltar [4]

15

Tarantula [5]

Page 16: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

“Motivational Example”

Page 17: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Spectrum-based fault localization

17

[1][2][4][5]

class CharCount { ...

static void count(String s){

int let, dig, other;

for(int i = 0; i < s.length(); i++) {

char c = s.charAt(i);

if (‟A‟<=c && ‟Z‟>=c)

let += 2; /* FAULT */

else if (‟a‟<=c && ‟z‟>=c)

let += 1;

else if (‟0‟<=c && ‟9‟>=c)

dig += 1;

else if (isprint(c))

other += 1; }

System.out.println(let+" "+ dig+" "+other); }

...}

0.63 0.63 0.67 0.67 1.00 0.67 0.22 0.53 0.57 0.00 0.00 0.63

S.C. 1 2 3 4 5 6 7 8 9

10 11 12

1 2 3 4 5 6 7 8 9 10

Error Vector

Page 18: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Lint static analysis

18

Lint yields issues that indicate potential

bugs.

Issues are characterized by their:

Category

Severity • Warning

• Error

• Fatal

Priority (values from 1 to 10);

Page 19: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Motivational Example

19

Page 20: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

“Tool”

Page 21: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Visualizations

21

Page 22: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Static and Dynamic Analysis

22

Page 23: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Static and Dynamic Analysis

23

Static

Dynamic + Static

Page 24: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

MZoltar„s Workflow

24

Obtaining program spectra

Logcat Sockets Files EMMA

Run Tests

ADT / ADB

Instrument

ASM ASMDex JaCoCo

Page 25: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

“Evaluation”

Page 26: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Research Questions

26

Is the instrumentation overhead

negligible?

Do diagnostiscs remain accurate

under Android‟s constrained

environment?

Does Lint integration contribute to a

better diagnostic quality?

Page 27: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Experimental Setup

27

Subject LOC Tests Coverage Resources LOC

CharCount 148 10 92,2% 115

ConnectBot 32911 14 0,7% 7673

Google Authenticator 3659 170 76,6% 5275

StarDroid 13783 187 29,7% 2694

Page 28: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Experimental Results

28

Subject Original Instrumented Overhead

CharCount 1,82s 1,86s 2%

ConnectBot 1,25s 1,35s 8%

Google Authenticator 80,49s 87,26s 8%

StarDroid 14,70s 15,46s 5%

Average Overhead: 5,75%

Page 29: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Metrics – Diagnostic Quality

29

Average number of lines to inspect

Coverage density

Page 30: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Multiple Faults / Run

30

Charcount Connectbot

Google Authenticator Stardroid

Page 31: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Multiple Tests / Run

31

Charcount Connectbot

Google Authenticator Stardroid

Page 32: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Multiple Tests / Run

32

Average Time Reduction: 79%

Average Cd Growth : 74%

Page 33: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Lint analysis results

33

Subject Dynamic Dynamic + Static

Bug 1 Bug 2 Bug 1 Bug 2

CharCount 148 148 0 1

ConnectBot 32911 32911 30 19

Google Authenticator 3659 3659 3 1

StarDroid 13783 13783 18 12

Average Cd Reduction: 99,9%

Page 34: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

“Conclusions”

Page 35: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Conclusions

The developer only has to inspect an average of 5

out of an average of 12625 lines, before finding the

bug;

Negligible instrumentation overhead (5.75%), despite the Android constrained environment;

Grouping tests cases reduces time by 79%, but

decreases diagnostic quality by 74%;

Lint integration reduces the number of lines to inspect

by 99.9%.

35

Page 36: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Conclusions

Reduce development costs

Reduce time to market

Increase quality and reliability

36

Page 37: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Future Work

Port MZoltar to the Android Studio IDE;

Port MZoltar to other mobile technologies;

Correlate Lint issues and Runtime failures;

Perform an User Study to evaluate MZoltar;

Investigate a bug prediction approach.

37

Page 38: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Publications

Published:

38

Submitted:

• Pedro Machado, José Campos and Rui Abreu,

Automatic Debugging of Android Applications.

In IJUP‟12, Porto, Portugal

• Pedro Machado, José Campos and Rui Abreu,

MZoltar: Automatic Debugging of Android Applications. In DeMobile‟13, St Petesburg,

Russia. (Co-located with ESEC/FSE)

• Pedro Machado, José Campos and Rui Abreu.

Combining Static and Dynamic Analysis in Mobile Apps Fault Localization. In ISSRE‟13,

Pasadena, CA, USA

Page 39: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

“Questions, anyone?”

Page 40: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Work Plan – 2nd Semester

Months February March April May June

Activities\Weeks 11 18 25 4 11 18 25 1 8 15 22 29 6 13 20 27 3 10 17

Framework

Architecture

particularities

Integration with

Gzoltar

Specific visualizations

Testing and

validating results

Article writing

Thesis writing

40

Page 41: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Motivation

Global smart phone sales v PC sales, 2011 (according to

Canalys)

Device Shipments 2011

(millions) Annual growth

Smartphones 487.7 62.7%

Tablets 63.2 274.2%

Notebooks 209.6 7.5%

Desktops 112.4 2.3%

Netbooks 29.4 -25.3%

Source: Canalys (Feb 2012)

41

Page 42: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Work Plan – 1st Semester

Months October November December January

Activities\Weeks 8 15 22 29 5 12 19 26 3 10 17 24 31 7 14 21 28

SFL Concept

Android Testing

Architecture particularities

Gzoltar

Preparation of first presentation

ADT

Preparation of second

presentation

Writing the state of the art

42

Page 43: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Metrics – Diagnostic Quality

43

Diagnostic Quality

Density

Page 44: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

Similarity Coefficients

44

Page 45: Automatic Debugging of Android Applicationsei07074/personal/assets/docs/presentation.… · Conclusions The developer only has to inspect an average of 5 out of an average of 12625

References

[1] R. Abreu, P. Zoeteweij, and A.J.C. van Gemund, Spectrum-based

Fault Localization. In Proceedings of 24th IEEE/ACM International

Conference on Automated Software Engineering (ASE‟09), Auckland,

New Zealand, November 2009. IEEE Computer Science.

[2] R. Abreu, P. Zoeteweij, and A.J.C. van Gemund, On the accuracy of

spectrum-based fault localization. In Proc. TAIC PART‟07, Sep 2007.

[3] T.A. Nguyen, C. Csallner and N. Tillmann, GROPG: A Graphical On-

Phone Debugger

[4] J. Campos, A. Riboira, A. Perez, R. Abreu: GZoltar: an Eclipse plug-in

for Testing and Debugging. ASE 2012

[5] Jones, J, Harrold, M.J.: Empirical evaluation of the tarantula

automatic fault-localization technique. ASE 2005

[6] http://developer.android.com

[7] A. P. Felt, E. Chin, S. Hanna, D. Song, and D. Wagner. Android

Permissions Demystied. In Proceedings of the 18th ACM Conference on

Computer and Communications Security, CCS ‟11, 2011

45