99
Woher kommen Software-Fehler? Andreas Zeller • Universität des Saarlandes

Woher kommen Software-Fehler?

Embed Size (px)

DESCRIPTION

Jeder Programmierer kennt die Situation: Ein Programm läuft nicht so, wie es soll.  Ich stelle Techniken vor, die automatisch (a) die Ursachen eines Fehlverhaltens finden - indem wir genau die Aspekte isolieren, die das Zustandekommen eines Fehlers verursachen; (b) Programmfehler finden - indem wir aus dem Code "normale" Anweisungsfolgen lernen und nach Abweichungen suchen; und (c) vorhersagen, wo in Zukunft Fehler auftreten werden - indem wir maschinell lernen, welche Code- und Prozesseigenschaften bisher mit Fehlern korrelierten. Fallstudien an echten Programmen mit echten Fehlern, von AspectJ über Firefox zu Windows demonstrieren die Praxistauglichkeit der vorgestellten Verfahren. Andreas Zeller ist Professor für Softwaretechnik an der Universität des Saarlandes in Saarbrücken.  Sein Forschungsgebiet ist die Analyse großer Software-Systeme und deren Fehler.  Sein Buch "Why Programs Fail - A Guide to Systematic Debugging" wurde 2006 mit dem Jolt Software Development Productivity Award ausgezeichnet. Vortrag der GI Regionalgruppe Rhein-Neckar 2008-06-19

Citation preview

Page 1: Woher kommen Software-Fehler?

Woher kommen Software-Fehler?Andreas Zeller • Universität des Saarlandes

Page 2: Woher kommen Software-Fehler?

Eine F-16(Nördliche Halbkugel)

Page 3: Woher kommen Software-Fehler?

Eine F-16(Südliche Halbkugel)

Page 4: Woher kommen Software-Fehler?

F-16 Fahrgestell

Page 5: Woher kommen Software-Fehler?

Flughafen Denver

Page 6: Woher kommen Software-Fehler?

Airport opened 16 mos later;Software firm (BEA) got bankruptOverall damage 1.8 bln

Page 7: Woher kommen Software-Fehler?

// Get #years, #days since 1980days = ...;year = 1980;while (days > 365) { if (IsLeapYear(year)) { if (days > 366) { days -= 366; year += 1; } } else { days -= 365; year += 1; }}

Page 8: Woher kommen Software-Fehler?

Der erste Bug9. September 1947

Page 9: Woher kommen Software-Fehler?

Der erste Bug9. September 1947

Page 10: Woher kommen Software-Fehler?
Page 11: Woher kommen Software-Fehler?

bug.aj@interface A {}

aspect Test { declare @field : @A int var* : @A; declare @field : int var* : @A;

interface Subject {}

public int Subject.vara; public int Subject.varb;}

class X implements Test.Subject {}

Page 12: Woher kommen Software-Fehler?
Page 13: Woher kommen Software-Fehler?
Page 14: Woher kommen Software-Fehler?
Page 15: Woher kommen Software-Fehler?

Diagnose Erkennen Vorbeugen

Woher kommen Software-Fehler? • Andreas Zeller, Universität des Saarlandes

Page 16: Woher kommen Software-Fehler?

Diagnose Erkennen Vorbeugen

Woher kommen Software-Fehler? • Andreas Zeller, Universität des Saarlandes

Page 17: Woher kommen Software-Fehler?

bug.aj@interface A {}

aspect Test { declare @field : @A int var* : @A; declare @field : int var* : @A;

interface Subject {}

public int Subject.vara; public int Subject.varb;}

class X implements Test.Subject {}

Page 18: Woher kommen Software-Fehler?

java.util.NoSuchElementException at java.util.AbstractList$Itr .next(AbstractList.java:427) at org.aspectj.weaver.bcel.BcelClassWeaver .weaveAtFieldRepeatedly (BcelClassWeaver.java:1016)

ajc Stack Trace

Page 19: Woher kommen Software-Fehler?

weaveAtFieldRepeatedly

for (Iterator iter = itdFields.iterator(); iter.hasNext();) { ... for (Iterator iter2 = worthRetrying.iterator(); iter.hasNext();) { ... }}

Page 20: Woher kommen Software-Fehler?
Page 21: Woher kommen Software-Fehler?

Lenhof, Hans-Peter,, +49 681 302-65501, [email protected], Christian, +49 681 9558506, +49 681 302 5590, [email protected], Martin,,, [email protected] zu Tittingdorf, Friederike, +49 6895 890055, +49 681 302-58099, [email protected], Yana,, +49 681 302-63020, [email protected]üller-Perich, Elisabeth,, +49 681 302-5050, [email protected], Naomi,, +49 68130265011, [email protected], Thilo,, +49 681 302-6595, [email protected], CC 2006,,, [email protected], Wolfgang, +4968151825, +49 6813022556, [email protected], Rahul, +55 5596955511, +49 681 302-65015, [email protected], Erich, +49 6551 912852, +49 681 302-58091, [email protected], David,, +49 681 302-63026, [email protected], Erika,, +49 6813025069, [email protected]äfer, Christa, +49 6895 51165, +49 68130265011,Security, AG,,, [email protected], Raimund, +49 6895 585698, +49 681 302-5515, [email protected], Sekretariat,, +49 681 302-65011, [email protected], Jacek, +491551555208,, [email protected], Philipp, +49 6826 1 88 51 52, +49 681 302-5850, [email protected] USA, Philipp, +1 650 591 9186, +1 508 586 2588, [email protected], Gert, +49 681 582550, +49 681 302-5511, [email protected], AG,,, [email protected], Frank,,, [email protected]ß, Cathrin,,, [email protected], Reinhard,, +49 681 302-5599, [email protected], Andreas,,, [email protected], Andreas, +49 681 5510565, +49 681 302-65011, [email protected], Tom, +49 851 51552 (Eltern), +1 505 210 9550, [email protected]

mozilla.csv

Page 22: Woher kommen Software-Fehler?

• Proceed by binary search. Throw away half the input and see if the output is still wrong.

• If not, go back to the previous state and discard the other half of the input.

Vereinfachen

mozilla.csv

✘✔✘✘✘✔

Page 23: Woher kommen Software-Fehler?

Lenhof, Hans-Peter,, +49 681 302-65501, [email protected], Christian, +49 681 9558506, +49 681 302 5590, [email protected], Martin,,, [email protected] zu Tittingdorf, Friederike, +49 6895 890055, +49 681 302-58099, [email protected], Yana,, +49 681 302-63020, [email protected]üller-Perich, Elisabeth,, +49 681 302-5050, [email protected], Naomi,, +49 68130265011, [email protected], Thilo,, +49 681 302-6595, [email protected], CC 2006,,, [email protected], Wolfgang, +4968151825, +49 6813022556, [email protected], Rahul, +55 5596955511, +49 681 302-65015, [email protected], Erich, +49 6551 912852, +49 681 302-58091, [email protected], David,, +49 681 302-63026, [email protected], Erika,, +49 6813025069, [email protected]äfer, Christa, +49 6895 51165, +49 68130265011,Security, AG,,, [email protected], Raimund, +49 6895 585698, +49 681 302-5515, [email protected], Sekretariat,, +49 681 302-65011, [email protected], Jacek, +491551555208,, [email protected], Philipp, +49 6826 1 88 51 52, +49 681 302-5850, [email protected] USA, Philipp, +1 650 591 9186, +1 508 586 2588, [email protected], Gert, +49 681 582550, +49 681 302-5511, [email protected], AG,,, [email protected], Frank,,, [email protected]ß, Cathrin,,, [email protected], Reinhard,, +49 681 302-5599, [email protected], Andreas,,, [email protected], Andreas, +49 681 5510565, +49 681 302-65011, [email protected], Tom, +49 851 51552 (Eltern), +1 505 210 9550, [email protected]

Fehlerursache

Page 24: Woher kommen Software-Fehler?

Lenhof, Hans-Peter,, +49 681 302-64701, [email protected], Christian, +49 681 9378406, +49 681 302 7790, [email protected], Martin,,, [email protected] zu Tittingdorf, Friederike, +49 6894 890037, +49 681 302-78099, [email protected], Yana,, +49 681 302-64020, [email protected]üller-Perich, Elisabeth,, +49 681 302-7070, [email protected], Naomi,, +49 68130264011, [email protected], Thilo,, +49 681 302-6794, [email protected], CC 2006,,, [email protected], Wolfgang, +4968171827, +49 6813022436, [email protected], Rahul, +44 7796973711, +49 681 302-64013, [email protected], Erich, +49 6371 912842, +49 681 302-78091, [email protected], David,, +49 681 302-64026, [email protected], Erika,, +49 6813027069, [email protected]äfer, Christa, +49 6895 51165, +49 68130265011,Security, AG,,, [email protected], Raimund, +49 6894 383698, +49 681 302-4713, [email protected], Sekretariat,, +49 681 302-64011, [email protected], Jacek, +491741333208,, [email protected], Philipp, +49 6826 1 88 71 32, +49 681 302-3830, [email protected] USA, Philipp, +1 670 391 9186, +1 408 486 2788, [email protected], Gert, +49 681 782770, +49 681 302-7311, [email protected], AG,,, [email protected], Frank,,, [email protected]ß, Cathrin,,, [email protected], Reinhard,, +49 681 302-4399, [email protected], Andreas,,, [email protected], Andreas, +49 681 3710467, +49 681 302-64011, [email protected], Tom, +49 871 71742 (Eltern), +1 403 210 9470, [email protected]

Fehlerursache

Page 25: Woher kommen Software-Fehler?

Problem:Vereinfachen von Hand

ist grausam!

Page 26: Woher kommen Software-Fehler?

Delta Debugging

Delta Debugging isoliert automatisch Fehlerursachen:

Eingaben: 1 von 436 Kontakten in Columba

Änderungen: 1 von 8,721 Änderungen in GDB

Threads: 1 von 3.8 bio Thread-Wechsel in Scene.java

➔ Automatisierte Fehlersuche

Page 27: Woher kommen Software-Fehler?

Problem:Benutzeraktionen simulieren

ist umständlich!

Page 28: Woher kommen Software-Fehler?

v: Vector

Vector()add()

remove()

remove() ↯Isolieren Relevanter Aufrufe

Schritt 1: Aufzeichnen

add()

remove()

Event log contains 32 interactions

JINSI

EventLog

Page 29: Woher kommen Software-Fehler?

v: Vector

Isolieren Relevanter AufrufeSchritt 2: Abspielen

Event log contains 32 interactions

JINSI

EventLog

Vector()add()

remove()

remove()

add()

remove() ↯

Page 30: Woher kommen Software-Fehler?

v: Vector

Isolieren Relevanter AufrufeSchritt 3: Vereinfachen

Event log contains 32 interactions

JINSI

EventLog

Vector()add()

remove()

remove()

add()

remove() ↯

Page 31: Woher kommen Software-Fehler?

Isolieren Relevanter AufrufeSchritt 4: Testfall erzeugen

Event log contains 32 interactions

JINSI

↯TexttestVector(){ Vector v = new Vector(); v.remove(obj);}

Page 32: Woher kommen Software-Fehler?

Columba ContactModel

c: ContactModel

ContactModel()setSortString()

setNickName()

setFamilyName()

setFormattedName()

setGivenName()

und 18732 weitere…

Page 33: Woher kommen Software-Fehler?

ContactModel()getPreferredEmail() c: ContactModel↯

Columba ContactModel

Page 34: Woher kommen Software-Fehler?

Unit Test

testContactModel(){ ContactModel c = new ContactModel(); String s = c.getPreferredEmail();}

Page 35: Woher kommen Software-Fehler?

getPreferredEmail public String getPreferredEmail() { Iterator it = getEmailIterator();

// get first item IEmailModel model = (IEmailModel) it.next();

// backwards compatiblity // -> its not possible anymore to create a // contact model without email address if (model == null) return null;

return model.getAddress(); }

Page 36: Woher kommen Software-Fehler?

Delta Debugging

Delta Debugging isoliert automatisch Fehlerursachen:

Eingaben: 1 von 436 Kontakten in Columba

Änderungen: 1 von 8,721 Änderungen in GDB

Threads: 1 von 3.8 bio Thread-Wechsel in Scene.java

➔ Automatisierte Fehlersuche

Aufrufe: 2 von 18738 Methodenaufrufen99,8%Verringerung des

Suchraums

Page 37: Woher kommen Software-Fehler?

#1 inSoftware Engineering BooksAlgorithms BooksSoftware Design Books

Page 38: Woher kommen Software-Fehler?

Diagnose Erkennen Vorbeugen

Woher kommen Software-Fehler? • Andreas Zeller, Universität des Saarlandes

Page 39: Woher kommen Software-Fehler?

Diagnose Erkennen Vorbeugen

Woher kommen Software-Fehler? • Andreas Zeller, Universität des Saarlandes

Page 40: Woher kommen Software-Fehler?

• Ungültige Benutzung von Iteratoren:vor next() sollte hasNext() kommen

• hasNext() ist operationale Vorbedingung

AspectJ Columba

Page 41: Woher kommen Software-Fehler?

Problem:Vorbedingungen spezifizieren

ist aufwändig!

Page 42: Woher kommen Software-Fehler?

OP-Miner

Programm iter.hasNext () iter.next ()

Benutzungsmodelle

hasNext ≺ nexthasNext ≺ hasNextnext ≺ hasNextnext ≺ next

Temporale Eigenschaften

hasNext ≺ nexthasNext ≺ hasNext

Muster

hasNext ≺ nexthasNext ≺ hasNext

hasNext ≺ nexthasNext ≺ hasNext✓

Anomalien

Page 43: Woher kommen Software-Fehler?

OP-Miner

Programm iter.hasNext () iter.next ()

Benutzungsmodelle

hasNext ≺ nexthasNext ≺ hasNextnext ≺ hasNextnext ≺ next

Temporale Eigenschaften

hasNext ≺ nexthasNext ≺ hasNext

Muster

hasNext ≺ nexthasNext ≺ hasNext

hasNext ≺ nexthasNext ≺ hasNext✓

Anomalien

Page 44: Woher kommen Software-Fehler?

Methodenmodelle

public Stack createStack () {Random r = new Random ();int n = r.nextInt ();Stack s = new Stack ();int i = 0;while (i < n) {s.push (rand (r));i++;

}s.push (-1);return s;

}

Page 45: Woher kommen Software-Fehler?

Methodenmodelle

public Stack createStack () {Random r = new Random ();int n = r.nextInt ();Stack s = new Stack ();int i = 0;while (i < n) {s.push (rand (r));i++;

}s.push (-1);return s;

}

Random r = new Random ();

Page 46: Woher kommen Software-Fehler?

Methodenmodelle

public Stack createStack () {Random r = new Random ();int n = r.nextInt ();Stack s = new Stack ();int i = 0;while (i < n) {s.push (rand (r));i++;

}s.push (-1);return s;

}

Random r = new Random ();

int n = r.nextInt ();

Stack s = new Stack ();

int i = 0;

Page 47: Woher kommen Software-Fehler?

Random r = new Random ();

int n = r.nextInt ();

Stack s = new Stack ();

int i = 0;

i < n i++;

s.push (rand (r));

Methodenmodelle

public Stack createStack () {Random r = new Random ();int n = r.nextInt ();Stack s = new Stack ();int i = 0;while (i < n) {s.push (rand (r));i++;

}s.push (-1);return s;

}

Page 48: Woher kommen Software-Fehler?

Random r = new Random ();

int n = r.nextInt ();

Stack s = new Stack ();

int i = 0;

i < n i < n i++;

s.push (-1); s.push (rand (r));

Methodenmodelle

public Stack createStack () {Random r = new Random ();int n = r.nextInt ();Stack s = new Stack ();int i = 0;while (i < n) {s.push (rand (r));i++;

}s.push (-1);return s;

}

Page 49: Woher kommen Software-Fehler?

Random r = new Random ();

int n = r.nextInt ();

Stack s = new Stack ();

int i = 0;

i < n i < n i++;

s.push (-1); s.push (rand (r));

Methodenmodelle

public Stack createStack () {Random r = new Random ();int n = r.nextInt ();Stack s = new Stack ();int i = 0;while (i < n) {s.push (rand (r));i++;

}s.push (-1);return s;

}

Page 50: Woher kommen Software-Fehler?

Random r = new Random ();

int n = r.nextInt ();

Stack s = new Stack ();

int i = 0;

i < n i < n i++;

s.push (-1); s.push (rand (r));

Benutzungsmodelle

Page 51: Woher kommen Software-Fehler?

Stack s = new Stack ();

s.push (-1); s.push (rand (r));

Benutzungsmodelle

Page 52: Woher kommen Software-Fehler?

Benutzungsmodelle

s.<init>()

s.push (_)

s.push (_)

Page 53: Woher kommen Software-Fehler?

Random r = new Random ();

int n = r.nextInt ();

Stack s = new Stack ();

int i = 0;

i < n i < n i++;

s.push (-1); s.push (rand (r));

Benutzungsmodelle

Page 54: Woher kommen Software-Fehler?

Random r = new Random ();

int n = r.nextInt ();

s.push (rand (r));

Benutzungsmodelle

Page 55: Woher kommen Software-Fehler?

Benutzungsmodelle

r.<init> ()

r.nextInt ()

Utils.rand (r)

Page 56: Woher kommen Software-Fehler?

OP-Miner

Programm iter.hasNext () iter.next ()

Benutzungsmodelle

hasNext ≺ nexthasNext ≺ hasNextnext ≺ hasNextnext ≺ next

Temporale Eigenschaften

hasNext ≺ nexthasNext ≺ hasNext

Muster

hasNext ≺ nexthasNext ≺ hasNext

hasNext ≺ nexthasNext ≺ hasNext✓

Anomalien

Page 57: Woher kommen Software-Fehler?

OP-Miner

Programm iter.hasNext () iter.next ()

Benutzungsmodelle

hasNext ≺ nexthasNext ≺ hasNextnext ≺ hasNextnext ≺ next

Temporale Eigenschaften

hasNext ≺ nexthasNext ≺ hasNext

Muster

hasNext ≺ nexthasNext ≺ hasNext

hasNext ≺ nexthasNext ≺ hasNext✓

Anomalien

Page 58: Woher kommen Software-Fehler?

Anomalien entdecken

open()

hello()

parse()

get()

Temporale Eigenschaften

Met

hode

n

start ≺stop

lock ≺unlock

eof ≺close

Page 59: Woher kommen Software-Fehler?

Ein Defekt

for (Iterator iter = itdFields.iterator(); iter.hasNext();) { ... for (Iterator iter2 = worthRetrying.iterator(); iter.hasNext();) { ... }}

sollte iter2 sein

Page 60: Woher kommen Software-Fehler?

Noch ein Defekt

public void visitNEWARRAY (NEWARRAY o) { byte t = o.getTypecode (); if (!((t == Constants.T_BOOLEAN) || (t == Constants.T_CHAR) || ... (t == Constants.T_LONG))) { constraintViolated (o, "(...) '+t+' (...)"); }} sollte “+t+” sein

Page 61: Woher kommen Software-Fehler?

Name internalNewName (String[] identifiers) ... for (int i = 1; i < count; i++) { SimpleName name = new SimpleName(this); name.internalSetIdentifier(identifiers[i]); ... } ...}

Ein Fehlalarm

sollte unverändertbleiben

Page 62: Woher kommen Software-Fehler?

Ein Code Smellpublic String getRetentionPolicy (){ ... for (Iterator it = ...; it.hasNext();) { ... = it.next(); ... return retentionPolicy; } ...}

sollte repariert werden

Page 63: Woher kommen Software-Fehler?

AspectJ

1642

242

Defekte Code smells Fehlalarme

Page 64: Woher kommen Software-Fehler?

Fehler findenTable 2: Summary of the results for the experiment subjects. (See Section 5.2 for a discussion.)

# Violations

Program Total Investigated # Defects # Code smells # False positives Efficiency

A��-Rʙ�� 0.8.2 25 25 2 13 10 60%A���ʜ� T����� 6.0.16 55 55 0 9 46 16%Aʀɢ�UML 0.24 305 28 0 12 16 43%A�����J 1.5.3 300 300 16 42 242 19%A��ʀ��� 2.5.0.0 315 85 1 26 58 32%C�ʟ��ʙ� 1.2 57 57 4 15 38 33%�E�ɪ� 4.2 11 11 0 4 7 36%

1,068 562 23 121 417 26%

public String getPreferredEmail () {Iterator it = getEmailIterator ();IEmailModel = (IEmailModel) it.next ();...

}

Figure 17: Another defect in C�ʟ��ʙ�. Missing call to hasNextcauses this method to throw an exception in certain circum-stances and thus cause a failure.

protected void loadPluginList () {...List bits = new ArrayList ();while (...) {

...if (...) {

bits.add (...);break;

}else {

bits.add (...);...

}}String version = (String) bits.get (0);String cvs_version = (String) bits.get (1);String name = (String) bits.get (2);...

}

Figure 18: A defect in A��ʀ���. The code does not check thesize of the bits list before accessing its elements. This methodwas fixed in version 2.5.0.2.

5.3 Limitations and Threats to Validity

The most important limitation of our approach is that it needs sub-stantial code bases to learn from. While this limitation can be par-tially circumvented (e.g. if one wants to use some library and wantsOP-Mɪɴ�ʀ to check if one is not making any mistakes, one can usesomeone else’s program to learn from), it is an unavoidable pricefor the ability to tap into developers’ knowledge and experiencethat is contained in those code bases. Also, OP-Mɪɴ�ʀ is only use-ful for single-threaded programs, but it can handle the whole J���language, including the exception handling.

We have identified the following potential threats to validity:

• We have investigated seven programs with different applica-tion domains, sizes and maturity and our results seem fairlyconsistent across those programs. However, it is possiblethat they do not generalize to arbitrary projects; proprietary,closed-source programs may have very different properties.

• The tools we have used (JADET and C�ʟɪʙʀɪ) could be de-fective. We think this is very improbable, especially for C�ʟ-ɪʙʀɪ, whose implementation is publicly available [28]. As forJADET as well as the OP-Mɪɴ�ʀ code, we have used andthoroughly validated it, so we believe that any defects left af-fect only a small number of OUMs and violations and thusdo not spoil the results overall.

• The results of the categorization process performed on vio-lations might depend on the expertise of the human apply-ing the approach. However, if anything, this would makeour results better than reported—because we have markedviolations as defects only if we were completely sure thatthey are indeed defects (e.g. by crashing the program, mak-ing sure the contract was violated, seeing the code changedin the way suggested by OP-Mɪɴ�ʀ, etc.). An experienceddeveloper may spot potential problems where we see falsepositives.

6. RELATED WORK

To the best of our knowledge, the present work is the first to takean operational view at preconditions—learning and checking whatneeds to be done to call a function. However, there are several otherapproaches that learn from existing code or that detect defects.

6.1 Learning from Code

Ernst et al. [15] have written the seminal work on inferring invari-ants dynamically using DAIKON. Later Hangal and Lam [22] cre-ated DIDUCE that detects and checks invariants. Csallner et al. [9]created DʏSʏ, which uses dynamic analysis together with symbolicexecution to discover relevant invariants. Flanagan and Leino [17]created H���ɪɴɪ which infers ESC/J��� [18] annotations from theprogram. These approaches can only produce axiomatic precon-ditions. Ramanathan et al. [35] produce axiomatic preconditions,unordered usage information (“this value was also used as a param-eter of the following functions: . . . ”), origin information and con-straints on method calls of the form “a call to g is always precededby a call to f”. However, these constraints are “must” as opposed toours “may” and are created separately from the static informationmentioned earlier. The upshot of this is that the interplay betweenmethods that can be represented is more limited than what OPs canrepresent. They used their approach to find defects, too, but un-fortunately did not report on the rate of false positives. Ray-YaungChang et al. [7] presented an approach for revealing neglected con-ditions in programs: they can learn so-called conditional rules andthen look for their violations.

Page 65: Woher kommen Software-Fehler?

OP-Miner

OP-Miner lernt operationale Vorbedingungen – wie man Argumente gewöhnlich konstruiert

Lernt aus gewöhnlicher Benutzung – allgemein und projektspezifisch

Vollautomatisch

Dutzende bestätigter Fehler gefunden

Page 66: Woher kommen Software-Fehler?

0

2,000

4,000

6,000

8,000

C-Projekte

6,097

0

50,000,000

100,000,000

150,000,000

200,000,000

Codezeilen

201,321,237

Page 67: Woher kommen Software-Fehler?
Page 68: Woher kommen Software-Fehler?
Page 69: Woher kommen Software-Fehler?

Ein Defektconspire-0.20 (IRC client)

static int dcc_listen_init (…) {dcc->sok = socket (…);if (…) {while (…) {… = bind (dcc->sok, …);

}/* with a small port range, reUseAddr is needed */setsockopt (dcc->sok, …, SO_REUSEADDR, …);

}listen (dcc->sok, …);

}muss vor bind() stehen

Page 70: Woher kommen Software-Fehler?
Page 71: Woher kommen Software-Fehler?

Diagnose Erkennen Vorbeugen

Woher kommen Software-Fehler? • Andreas Zeller, Universität des Saarlandes

Page 72: Woher kommen Software-Fehler?

Diagnose Erkennen Vorbeugen

Woher kommen Software-Fehler? • Andreas Zeller, Universität des Saarlandes

Page 73: Woher kommen Software-Fehler?
Page 74: Woher kommen Software-Fehler?

Problem:Wie können wir aus

unseren Fehlern lernen?

Page 75: Woher kommen Software-Fehler?

Fehler Versionen

Page 76: Woher kommen Software-Fehler?

Fehler Versionen

Fehler auf Code abbilden

Page 77: Woher kommen Software-Fehler?

Fehler in AspectJ

Page 78: Woher kommen Software-Fehler?

Sicherheitslückenin Firefox

Woher kommen diese Fehler?

Page 79: Woher kommen Software-Fehler?

Sind es die Entwickler?

Macht Erfahrung einen Unterschied?

Je mehr Erfahrung, desto

mehr Fehler!

Page 80: Woher kommen Software-Fehler?

Oder die Geschichte?

Wir haben hier viele Fehler gefunden…

Dann sind dort noch mehr!

Page 81: Woher kommen Software-Fehler?

Wie steht es mit Metriken?

Korrelieren Metriken mit Fehlerdichte? Manchmal!

Page 82: Woher kommen Software-Fehler?

Programmiersprache?

Sind gotos schädlich?

Keine Korrelation!

Page 83: Woher kommen Software-Fehler?

Ok. Problembereich?

Welche Tokens sind relevant?

import • extends • implements

Page 84: Woher kommen Software-Fehler?

nsIPrivateDOMEvent.h

nsReadableUtils.h

✘✘

Page 85: Woher kommen Software-Fehler?

Vorhersage Komponente Tatsache

1 nsDOMClassInfo 3

2 SGridRowLayout 95

3 xpcprivate 6

4 jsxml 2

5 nsGenericHTMLElement 8

6 jsgc 3

7 nsISEnvironment 12

8 jsfun 1

9 nsHTMLLabelElement 18

10 nsHttpTransaction 35

Page 86: Woher kommen Software-Fehler?

• Wissen, wo die Fehler sind

• Kalibrieren der Fehlervorhersage

• Wissen, wo die nächsten Fehler sind

• Vollautomatisch!

Page 87: Woher kommen Software-Fehler?

Fehler Versionen

• enthalten komplette Projektgeschichte

• gepflegt durch Programmierumgebungen

• automatischer Zugang

• frei verfügbar durch Open-Source Projekte

Software-Archive

Page 88: Woher kommen Software-Fehler?

Fehler VersionenAufwand Navigation Chatse-mail

Modelle Specs Code Traces Profile Tests

Page 89: Woher kommen Software-Fehler?

Fehler VersionenAufwand Navigation Chatse-mail

Modelle Specs Code Traces Profile Tests

Page 90: Woher kommen Software-Fehler?

Daten sammeln

Page 91: Woher kommen Software-Fehler?
Page 92: Woher kommen Software-Fehler?
Page 93: Woher kommen Software-Fehler?

Studien

Rosenberg, L. and Hyatt, L. “Developing An Effective Metrics Program”European Space Agency Software Assurance Symposium, Netherlands, March, 1996

Make thisActionable!

Page 94: Woher kommen Software-Fehler?
Page 95: Woher kommen Software-Fehler?
Page 96: Woher kommen Software-Fehler?
Page 97: Woher kommen Software-Fehler?
Page 98: Woher kommen Software-Fehler?

Diagnose Erkennen Vorbeugen

Woher kommen Software-Fehler? • Andreas Zeller, Universität des Saarlandes

Page 99: Woher kommen Software-Fehler?

Diagnose Erkennen Vorbeugen

Woher kommen Software-Fehler? • Andreas Zeller, Universität des Saarlandes

ZELLER

FAILA Guide to Systematic Debugging

A N D R E A S Z E L L E R

WHY PROGRAM

S FAIL

WHY PROGRAMS