TAILIEUCHUNG - Lecture Introduction to computing systems (2/e): Chapter 15 - Yale N. Patt, Sanjay J. Patel

Chapter 15 - Debugging. This chapter presents the following content: Debugging with high level languages, types of errors, syntactic errors, semantic errors, algorithmic errors, source-level debugger, source-level debugging techniques. | Chapter 15 Debugging Debugging with High Level Languages Same goals as low-level debugging Examine and set values in memory Execute portions of program Stop execution when (and where) desired Want debugging tools to operate on high-level language constructs Examine and set variables, not memory locations Trace and set breakpoints on statements and function calls, not instructions .but also want access to low-level tools when needed 15- Types of Errors Syntactic Errors Input code is not legal Caught by compiler (or other translation mechanism) Semantic Errors Legal code, but not what programmer intended Not caught by compiler, because syntax is correct Algorithmic Errors Problem with the logic of the program Program does what programmer intended, but it doesn't solve the right problem 15- Syntactic Errors Common errors: missing semicolon or brace mis-spelled type in declaration One mistake can cause an avalanche of errors because compiler can't recover and gets confused main () { int i int j; for (i = 0; i 15- Semantic Errors Common Errors Missing braces to group statements together Confusing assignment with equality Wrong assumptions about operator precedence, associativity Wrong limits on for-loop counter Uninitialized variables h main () { int i int j; for (i = 0; i 15- Algorithmic Errors Design is wrong, so program does not solve the correct problem Difficult to find Program does what we intended Problem might not show up until many runs of program Maybe difficult to fix Have to redesign, may have large impact on program code Classic example: Y2K bug only allow 2 digits for year, assuming 19__ 15- Debugging Techniques Ad-Hoc Insert printf statements to track control flow and values Code explicitly checks for values out of expected range, etc. Advantage: No

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.