Automated Bug Localization.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
Partha Pratim Ray Automated bug localization in embedded softwares A new paradigm through holistic approaches i -f n5.26 'LAMBERT % P12-CL Academic Publishing 39231 _T. Partha Pratim Ray Automated bug localization in embedded softwares A new paradigm through holistic approaches ONIVf- '/VtU-s iw)" • LAP LAMBERT Academic Publishing Impressum/Imprint (nur fur Deutschland/only for Germany) Bibliografische Information der Deutschen Nationalbibliothek: Die Deutsche Nationalbibliothekverzeichnet diese Publlkatlon in der Deutschen Natlonalblbliografie; detaillierte bibliografische Daten sind im Internet iiber http://dnb.d-nb.de abrufbar. Aile in diesem Buch genannten Marken und Produktnamen unterliegen warenzeichen-, marken- oderpatentrechtlichem Schutz bzw. sind Warenzeichen oder eingetragene Warenzeichen derjeweiligen Inhaber. Die Wiedergabe von Marken, Produktnamen, Gebrauchsnamen, Handelsnamen, Warenbezeichnungen u.s.w. in diesem Werk berechtigt auch ohne besondere Kennzeichnung nicht zu der Annahme, dass solche Namen im Sinne der Warenzeichen- und Markenschutzgesetzgebung als frei zu betrachten waren und daher von jedermann benutzt werden diirften. Coverbild: www.ingimage.com Verlag: LAP LAMBERT Academic Publishing GmbH&Co. KG Heinrich-Bocking-Str. 6-8,66121 Saaibriicken, Deutschland Telefon +49 681 3720-310. Telefax +49 681 3720-3109 Email: info@lap-pub!ishing.com Approved by: Haldia,West Bengal Universityof Technology, Thesis, 2011 Hersteilung in Deutschland: Schaltungsdienst Lange o.H.G., Berlin Books on Demand GmbH, Norderstedt Reha GmbH, Saarbrucken Amazon Distribution GmbH, Leipzig ISBN: 978-3-8484-4439-7 Imprint (only for USA, CB) Bibliographic information published by the Deutsche Nationalbibliothek: The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data are available in the Intemet at httpV/dnb.d-nb.de. Any brand names and product names mentioned in this book are subject to trademark, brand or patent protection and are trademarks or registered trademarks of their respective holders. The use of brand names, product names, common names, trade names, product _descriptions etc. even without a particular marking in this works is in no way to be construed to mean that such names may be regarded as unrestricted in respect of trademark and brand protection legislation and could thus be used by anyone. Coverimage: www.ingimage.com Publisher: LAP LAMBERT Academic Publishing GmbH 8i Co. KG Heinrich-Bocking-Str. 6-8, 66121 Saarbrucken, Germany Phone +49 681 3720-310, Fax+49 681 3720-3109 Email: [email protected] Printed in the U.S.A. Printed in the U.K. by (see last page) ISBN: 978-3-8484-4439-7 Copyright © 2012 by the author and LAP LAMBERT Academic Publishing GmbH 8.Co. KG and licensors /• n t All rights reserved. Saarbrucken 2012 0 0^' Call —.1 •*" A»N..33..aS.l 0-1^^I ^ Additionally, I want to thank the faculties and staffofElectronics and Communication Engineering department for all their help to complete my degree and prepare for a career as a enthusiastic science-seeker. This includes (but certainly is not limited to) the following individuals: Dr. Sunandan Bhunia He made it possible for me to have many wonderful experiences I enjoyed as a student, including the opportunity to get in touch with the external sources of knowledge base such as ISI, Kolkata. His believe and immense support on me and my work encouraged to move ahead in research work. 1 want to greet a veiy special thank to him. Mr. Soutav Kumar Das His constant help and faith in Embedded Systems Laboratory during last few months provided me great support in completing my work. And finally, I must thank my dear friends, father and mother, well wishers and obviously Poulami Majumder, for putting up with me during the development of this work with continuing, loving support and no complaint. I do not have the words to express all my feelings here, only that 1 love you, all! Place: Haldia Date: 29"" April, 2011 Partha Pratim Ray -^•Iditionaiiy^ I Abstract individuals. ' "'^"'^•seeker, n,: . *'°'np'etc my degree amJ prepare fof " Debugging denotes the process of detecting root causes of unexpected observable behaviors in prograins,- such as a program crash, an unexpected output value being produced or an assertion violation. Debugging of program errors is a difficult task and often takes "lade i(' „Possible for tn a significant amount of time in the software development life cycle. In the context of embedded software, the probability of bugs is quite high. Due to requirements of low "PPortunity "'nnderful experiences Ienjoyed as a code size and less resource consumption, embedded softwares typically do away with a """ ">y '^orJt Koikata" lot of sanity checks during development time. This leads to high chance of errors being special th (q believe and immense support on ree uncovered in the production code at ran time. OB-' Debugging embedded softwares is a common problem. Several techniques and tools do exist for solving this problem. However, various kinds of bugs remain untouched regarding '^natanthj,- unauthorized and inefficient memory related issues and few bugs may also reside inside the states of the software code. No feasible algorithm or technique has ever been developed ^"d tinallv t '"PPort [„ ^a'anis Laboratory during; last fe^ that will solve all the particular cases ofthis problem accurately. It turns out, though, that the width of the debugging metrics are quite important in a "m^°'' "" •"h"!'"'" •""' """P'. WP" wi.hcr, .nd »l>«°yi}\y large number of the embedded systems having various buggy issues. This becomes readily '"•"IP.h.,,, "•= <l=....pmc„. of .hi. ««'"vvitP apparent when weleam that the bugs typically come from inaccurate debugging technique. Any measurement of a buggy metric is limited by the precision and accuracy of the debugging technique. Tobe of practical use, the debugging process must be reasonably ac curate. This implies that, for most of the parts, the actual values associated with measure ments lie within relatively narrow interval parameters or metrics such as memory, invariant and object state. Indeed, manufacturers often guarantee the error of their softwares to be very small. Thus, we desire to look only at narrow interval parameters when considering the devel opment of the methodology for debugging embedded softwares. As no such effective tech niques exist that can solve such software problems, developing such methodologies seems Partha Pratim Ray indeed promising. Therefore, the goal ofthis thesis is to answer the following question: Table of Contents "y ated technique or methodology be developedfor the general prob- - "f'^^bus^ngembedded.ofr.are. .ith narrow interval parameters? Page coefficiems ' Problem of debugging embedded softwares with narrow interval i Acknowledgements i that win 1 . '' Mnsider it possible to develop a feasible technique Abstract ill --"-ive an partieular eases Of this problem automatically. Table ofContents v Chapter 1 Introduction 1 2 Literature Review 3 2.1 Software Bug 3 2.1.1 Types ofBugs 3 2.1.2 Bug Handling 5 2.2 Debugging 5 2.3 Embedded System 6 Sb. 2.3.1 Embedded Processors 7 2.3.2 Features ofEmbedded Systems 7 2.4 Embedded Software 8 2.4.1 Characteristics of Embedded Software 9 2.4.2 Embedded Software Architecture 10 2.4.3 Models ofComputation 11 2.5 BusyBox 12 2.5.1 Overall View of BusyBox 13 2.5.2 Usage 13 2.5.3 Bugs in BusyBox 13 3 Related Work 17 4 Memory Error Detection 20 4.1 Valgrind 20 4.1.1 Introduction 20 V 4.1.2 Interpreting Memchecks Output 21 4.2 Bug Analysis 24 4.2.1 Analyzing the Aip Bug in BusyBox 24 4.2.2 Analyzing the Top Bug in BusyBox 24 5 Invariant Analysis 32 5.1 Introduction _ 32 5.1.1 Invariant 32 5.1.2 Program Point . 32 5.1.3 Nonsensical 33 5.2 Daikon _ _ 33 5.2.1 Introduction 33 5.2.2 Executing Daikon 34 5.3 Methodology 35 5.4 Concept of Aip Bug Behind Our Approach 38 5.5 Bug Analysis _ 3g 5.5.1 Trace File Generation _ _ 4] 5.5.2 Invariant Detection 4I 5.5.3 Invariant Comparison . 43 5.5.4 Output Analysis 43 6 Object State Incorporated Debugging-OSiD 45 6.1 Introduction 6.2 Class Dependence Graph 4g 6.3 Our Approach 6.4 Bug Localization 6.4.1 Test OOP and Other Metrics jq 6.4.2 State Chart ^ 6.4.3 Stale Transition Table 6.4.4 CIdg Representation of the Test Program 53 6.4.5 Test Suite Deployment 6.4.6 State Information Comparison jg vi 6-4.7 Slate Comparison Matrix -"%.-- 57 4 2 21 Bug Analysis 6.4.8 Source Level Bug Localization 57 24 7 Conclusion and Future Work 59 24 List ofPublications 60 24 References 61 5-1 Introduction 32 5-I'l Invariant. 32 ^-'-2 Program Point 32 5-1-3 Nonsensical 32 5-2 Daikon .. 33 5-2-1 Introduction 33 ^-2-2 Executing Daikon 33 Methodology 34 35 38 T" 38 ^•-2 '"variant Detection. 41 • '"variant Comparison 41 6 Obi , 43 43 46 46 E"8 Locallaation 46 47 49 50 52 52 '"'""nation Com^""ipatisoQ""••••-. 53 53 56 Chapter 1 Introduction Embedded softwares are the heart ofembedded systems. The development ofembedded softwares need to undergo the process ofgeneral software development cycle, resulting in code development and debugging as important activities. Embedded softwares typically do away with lot of sanity checks during development time. This leads to high chance of errors being uncovered in the production code at nm time. In this thesis we propose a methodology for debugging errors in embedded softwares. As a case study we have used BusyBox. de-facto standard for embedded Linux in embedded systems and a few pseudo codes tescmbiing a few blocks of embedded BusyBox. Our first methodology works on top ofValgrind, a popular memory error detector.