SlideShare a Scribd company logo
1 of 83
Introduction to PHPIntroduction to PHP
Bugs - DebuggingBugs - Debugging
What You Won’t LearnWhat You Won’t Learn
• how to solve all your problems
• the one true way to avoid all bugs
• Many platform specific debugging techniques
DocumentationDocumentation
• learn where the documentation for your system is
and use it
• when in doubt, look it up!
- Internet is your friend, but many cluless people so must filter. Use
definitive sources if you can
- man pages/Info system for Unix systems
- MSDN for windows
- javadoc for Java libraries
- /Developer/Documentation for Mac OS X
DebuggingDebugging
• Debugging is a black art. Some things to
go over, though, so they’ll be concrete in
our brains:
o relation to testing
o why debugging is hard
o types of bugs
o process
o techniques
o tools
o avoiding bugs
Debugging and testingDebugging and testing
• Testing and debugging go together like peas in a
pod:
o Testing finds errors; debugging localizes and repairs
them.
o Together these form the “testing/debugging cycle”:
we test, then debug, then repeat.
o Any debugging should be followed by a reapplication
of all relevant tests, particularly regression tests. This
avoids (reduces) the introduction of new bugs when
debugging.
o Testing and debugging need not be done by the same
people (and often should not be).
Why debugging is hardWhy debugging is hard
• There may be no obvious relationship between the external
manifestation(s) of an error and its internal cause(s).
• Symptom and cause may be in remote parts of the program.
• Changes (new features, bug fixes) in program may mask (or
modify) bugs.
• Symptom may be due to human mistake or misunderstanding
that is difficult to trace.
• Bug may be triggered by rare or difficult to reproduce input
sequence, program timing (threads) or other external causes.
• Bug may depend on other software/system state, things others
did to you systems weeks/months ago.
Designing for Debug/TestDesigning for Debug/Test
• when you write code think about how you are
going to test/debug it
- lack of thought always translates into bugs
• write test cases when you write your code
• if something should be true assert() it
• create functions to help visualize your data
• design for testing/debugging from the start
• test early, test often
• test at abstraction boundaries
Fault InjectionFault Injection
• many bugs only happen in the uncommon case
• make this case more common having switches that
cause routines to fail
- file open, file write, memory allocation, are all good candidates
- Have “test drivers” which test with the uncommon
data. If deeply buried, test with a debugger script
Finding and Fixing BugsFinding and Fixing Bugs
• in order to create quality software you need to find
your bugs
- testing
- user reports
• the best bugs are those that are always
reproducible
Types of bugsTypes of bugs
• Types of bugs (gotta love em):
o Compile time: syntax, spelling, static type mismatch.
• Usually caught with compiler
o Design: flawed algorithm.
• Incorrect outputs
o Program logic (if/else, loop termination, select case, etc).
• Incorrect outputs
o Memory nonsense: null pointers, array bounds, bad types, leaks.
• Runtime exceptions
o Interface errors between modules, threads, programs (in
particular, with shared resources: sockets, files, memory, etc).
• Runtime Exceptions
o Off-nominal conditions: failure of some part of software of
underlying machinery (network, etc).
• Incomplete functionality
o Deadlocks: multiple processes fighting for a resource.
• Freeze ups, never ending processes
The ideal debuggingThe ideal debugging
processprocess
• A debugging algorithm for software engineers:
o Identify test case(s) that reliably show existence of fault (when
possible)
o Isolate problem to small fragment(s) of program
o Correlate incorrect behavior with program logic/code error
o Change the program (and check for other parts of program
where same or similar program logic may also occur)
o Regression test to verify that the error has really been removed
- without inserting new errors
o Update documentation when appropriate
(Not all these steps need be done by the same person!)
General AdviceGeneral Advice
• try to understand as much of what is
happening as possible
• “it compiles” is NOT the same as “it works”
• when in doubt, ask. Then test the answer!
• Error messages are generally just a vague
hint and can be misleading.
• Don’t always trust the
“comments/documents”, they can be out-
of-date.
What is a Debugger?What is a Debugger?
“A software tool that is used to detect the source of
program or script errors, by performing step-by-step
execution of application code and viewing the
content of code variables.”
-MSDN
What is a Debugger?What is a Debugger?
(con't)(con't)
• A debugger is not an IDE
o Though the two can be integrated, they are separate entities.
• A debugger loads in a program (compiled executable,
or interpreted source code) and allows the user to
trace through the execution.
• Debuggers typically can do disassembly, stack traces,
expression watches, and more.
Why use a Debugger?Why use a Debugger?
• No need for precognition of what the error might be.
• Flexible
o Allows for “live” error checking – no need to re-write and re-compile when you
realize a certain type of error may be occuring
o Dynamic
o Can view the entire relevant scope
Why people don’tWhy people don’t use a Debugger?use a Debugger?
• With simple errors, may not want to bother with starting
up the debugger environment.
o Obvious error
o Simple to check using prints/asserts
• Hard-to-use debugger environment
• Error occurs in optimized code
• Changes execution of program (error doesn’t occur
while running debugger)
Debugging techniques, 1Debugging techniques, 1
• Execution tracing
o running the program
o print
o trace utilities
o single stepping in debugger
o hand simulation
Debugging techniques, 2Debugging techniques, 2
• Interface checking
o check procedure parameter number/type (if not
enforced by compiler) and value
o defensive programming: check inputs/results from
other modules
o documents assumptions about caller/callee
relationships in modules, communication protocols,
etc
• Assertions: include range constraints or other
information with data.
• Skipping code: comment out suspect code,
then check if error remains.
Other Functions of aOther Functions of a
DebuggerDebugger
• Disassembly (in context and with live data!)
• Execution Tracing/Stack tracing
• Symbol watches
DisassemblyDisassembly
• Most basic form of debugging
• Translating machine code into assembly instructions
that are more easily understood by the user.
• Typically implementable as a simple lookup table
• No higher-level information (variable names, etc.)
• Relatively easy to implement.
Execution TracingExecution Tracing
• Follows the program through the execution. Users
can step through line-by-line, or use breakpoints.
• Typically allows for “watches” on – registers,
memory locations, symbols
• Allows for tracing up the stack of runtime errors
(back traces)
• Allows user to trace the causes of unexpected
behavior and fix them
Symbol InformationSymbol Information
• Problem – a compiler/assembler translates variable
names and other symbols into internally consistent
memory addresses
• How does a debugger know which location is
denoted by a particular symbol?
• We need a “debug” executable.
Debug vs. Release BuildsDebug vs. Release Builds
• Debug builds usually are not optimized
• Debug executables contain:
o program's symbol tables
o location of the source file
o line number tags for assembly instructions.
• GCC/GDB allows debugging of optimized code.
Bug hunting with print
• Weak form of debugging, but still common
• How bug hunting with print can be made more useful:
– print variables other than just those you think
suspect.
– print valuable statements (not just “hin”).
– use exit() to concentrate on a part of a program.
– move print through a through program to track down
a bug.
Debugging with print (continued)
• Building debugging with print into a program (more
common/valuable):
– print messages, variables/test results in useful places
throughout program.
– use a ‘debug’ or ‘debug_level’ global flag to turn
debugging messages on or off, or change “levels”
– possibly use a source file preprocessor (#ifdef) to
insert/remove debug statements.
– Often part of “regression testing” so automated
scripts can test output of many things at once.
Finding ReproducibleFinding Reproducible
BugsBugs
• a bug happens when there is a mismatch
between what you (someone) think is
happening and what is actually happening
• confirm things you believe are true
• narrow down the causes one by one
• make sure you understand your program
state
• keep a log of events and assumptions
Finding ReproducibleFinding Reproducible
BugsBugs
• try explaining what should be happing
- Verbalization/writing often clarifies muddled thoughts
• have a friend do a quick sanity check
• don’t randomly change things, your actions should
have a purpose.
o If you are not willing to check it into CVS with a log that your boss may
read, then you are not ready to make that change to the code.
o Think it through first, both locally and globally.
(semi) irreproducible(semi) irreproducible
bugsbugs
• sometimes undesired behavior only happens
sporadically
• tracking down these heisenbugs is hard
• the error could be a any level
- Circuits (e.g. bad ram chip at high memory address)
- compiler
- os
- Linker
- Irreproducible external “data” and timing
Finding HeisenBugsFinding HeisenBugs
• Use good tools like Purify. Most common “Heisenbugs”
are memory or thread related.
• try to make the bug reproducible by switching
platforms/libraries/compilers
• insert checks for invariants and have the program stop
everything when one is violated
• verify each layer with small, simple tests
• find the smallest system which demonstrates the bug
• Test with “canned data”, replayed over net if needed.
Timing and ThreadingTiming and Threading
BugsBugs
• ensure the functionality works for a single thread
• if adding a printf() removes the bug it is almost
certainly a timing/threading bug or a trashed
memory bug
• try using coarse grained locking to narrow down
the objects involved
• try keeping an event (transaction) log
Memory Bugs and Buffer OverflowMemory Bugs and Buffer Overflow
• Trashing stack/heap causes often difficult to
find bugs.
• Manifestation can be far from actual bug.
o “Free list” information generally stored just after a
“malloced” chunck of data. Overwriting may not
cause problem until data is “freed”, or until
something else does a malloc after the free.
o Stack variables, overwriting past end, changes
other variables, sometimes return address. (Buffer
overflow)
o Bad “string” ops notorious, using input data can
also be problematic.
An example….An example….
void myinit(int startindex, int startvalue, int length, int* vect){
int i;
for(i=startindex; i< startindex+length; i++)
*vect++ = startvalue++;
}
void whattheheck(){ printf("How did I ever get here????n"); exit(2); }
int main(int argc, char**argv){
float d;
int a,b[10],c, i, start,end;
if(argc != 3) {printf("Usage:%s start, endn",argv[0]);exit(-1); }
start=atoi(argv[1]); end=atoi(argv[2]); /* bad style but shorter */
a=0; c=0; d=3.14159; /* bad style but shorter */
printf("Initally a %d, c %d, d %f, start %d, end %dn",a,c,d, start,end);
myinit(start,start,end,b+start);
printf("finally a %d, c %d, d %f start %d, end %d n",a,c,d, start, end);
if(end>10) b[end-1]=134513723;
return 0;
}
Debugging TechniquesDebugging Techniques
• methodology is key
• knowing about lots of debugging tools helps
• the most critical tool in your arsenal is your
brain
• second most important tool is a debugger
o Core dumps are your friends.. Learn how to use
them.
• Memory debugging tools third most
important
• Profiler fourth
ToolsTools
• Tracing programs:
o strace, truss (print out system calls),
o /bin/bash –X to get a shell script to say what its
doing
• Command-line debuggers :
o gdb (C, C++), jdb (java), “perl -d”
• Random stuff:
o electric fence or malloc_debug, mtrace, etc (a
specialized malloc() for finding memory leaks in
C/C++)
o purify (Part of Rational Suite, a really good memory
debugging tools for C/C++ programs)
DebuggersDebuggers
• allow programs to inspect the state of a running
program
• become more important when debugging
graphical or complex applications
• jdb and gjdb for java
• gdb for C/C++ programs on unix/Max
• MSVS for Win32
• kdb for the linux kernel
Using gdbUsing gdb
• Compile debugging information into
your program:
gcc -g <program>
• Read the manual:
o man gdb
oin emacs (tex-info):
http://www.cslab.vt.edu/manuals/gdb/gdb_toc.html
M-x help <return> i <return>, arrow to GDB, <return>
oonline:
gdb comandsgdb comands
run/continue/next/step: start the program, continue
running until break, next line (don’t step into
subroutines), next line (step into subroutines).
break <name>: set a break point on the named
subroutine. Debugger will halt program execution
when subroutine called.
backtrace: print a stack trace.
print <expr>: execute expression in the current
program state, and print results (expression may
contain assignments, function calls).
help: print the help menu. help <subject> prints a
subject menu.
quit: exit gdb.
General GDBGeneral GDB
• easiest to use inside of emacs (M-x gdb)
• run starts the program
• set args controls the arguments to the program
• breakpoints control where the debugger stops
the program (set with C-x space)
• next moves one step forward
• step moves one step forward and also traverses
function calls
• continue runs the program until the next
breakpoint
General GDBGeneral GDB
• p prints a value (can be formated)
- /x hex
- /o octal
- /t binary (t is for two)
- /f float
- /u unsigned decimal
General GDBGeneral GDB
• bt shows the current backtrace (also where)
• up/down move up down the stack
• f # lets you switch to frame # in the current
backtrace
• set var=value
• call allows call of a function (the syntax can get
funky)
• jump (dump to a particular line of code)
• Thread # lets you switch to a particular thread
Advanced GDBAdvanced GDB
• watchpoints let you check if an expression
changes
• catchpoints let you know when interesting things
like exec calls or library loads happen
• x lets you inspect the contents of memory
• Watchpoints can be quite slow, best to combine
with breakpoints.
Advanced GDBAdvanced GDB
• gcc 3.1 and up provides macro information to gdb
if you specify the options -gdwardf2 and -g3 on the
command line
• you can debug and already running process with
the attach pid command
• you can apply a GDB command to all threads with
thread apply all
• GDB can be used to debug remote embedded
systems (gdbserver, etc..)
The example in gdbThe example in gdb
void myinit(int startindex, int startvalue, int length, int* vect){
int i;
for(i=startindex; i< startindex+length; i++)
*vect++ = startvalue++;
}
void whattheheck(){ printf("How did I ever get here????n"); exit(2); }
int main(int argc, char**argv){
float d;
int a,b[10],c, i, start,end;
if(argc != 3) {printf("Usage:%s start, endn",argv[0]);exit(-1); }
start=atoi(argv[1]); end=atoi(argv[2]); /* bad style but shorter */
a=0; c=0; d=3.14159; /* bad style but shorter */
printf("Initally a %d, c %d, d %f, start %d, end %dn",a,c,d, start,end);
myinit(start,start,end,b+start);
printf("finally a %d, c %d, d %f start %d, end %d n",a,c,d, start, end);
if(end>10) b[end-1]=134513723;
return 0;
}
JDBJDB
• Compile your source file with -g option
o Produce debugging information
o For example
javac –g rsdimu.java
• To run jdb,
o Type “jdb”, use run command to load an
executable
• run <class name>
• For example, run rsdimu
o OR type “jdb <class name>, then
• Type “run” to execute the program
o Type “quit” to exit jdb
BreakpointBreakpoint
• Make your program stops whenever a certain point
in the program is reached
• For example
o Make a breakpoint in
line 6
stop at Demo:6
o Program stops before
execute line 6
o Allow you to examine
code, variables, etc.
public class Demo
{
public static void main(…)
{
System.out.println(“An”);
System.out.println(“Bn”);
System.out.println(“Cn”);
}
}
1
2
3
4
5
6
7
8
9
BreakpointBreakpoint
• Add breakpoint
o stop at MyClass:<line num>
o stop in java.lang.String.length
o stop in MyClass.<method name>
• Delete breakpoint
o clear (clear all breakpoints)
o clear <breakpoint>
• e.g. clear MyClasss:22
StepStep
• Execute one source line, then stop and return to
JDB
• Example
public void func()
{
System.out.println(“An”);
System.out.println(“Bn”);
System.out.println(“Cn”);
return 0;
}
public void func()
{
System.out.println(“An”);
System.out.println(“Bn”);
System.out.println(“Cn”);
return 0;
}
step
NextNext
• Similar to step, but treat function call as one source line
• Example
next
public void func1() {
println(“Bn”);
println(“Cn”);
}
public void func() {
println(“An”);
func1();
return 0;
}
public void func1() {
println(“Bn”);
println(“Cn”);
}
public void func() {
println(“An”);
func1();
return 0;
}
step
ContCont
• Resume continuous execution of the program until
either one of the followings
o Next breakpoint
o End of program
PrintPrint
• Print
o Display the value of an expression
• print expression
o print MyClass.myStaticField
o print i + j + k
o print myObj.myMethod() (if myMethod returns a non-null)
o print new java.lang.String("Hello").length()
• Dump
o Display all the content of an object
• dump <object>
Analysis ToolsAnalysis Tools
Purpose of Analysis ToolsPurpose of Analysis Tools
• Need for a feasible method to catch bugs in large
projects. Formal verification techniques require
unreasonable effort on large projects.
• Augment traditional debugging techniques
without adding unreasonable burden to the
development process.
Two Types of AnalysisTwo Types of Analysis
ToolsTools
• Static Analysis
• Run-time (dynamic) Analysis
SplintSplint
• Open Source Static Analysis Tool developed at
U.Va by Professor Dave Evans.
• Based on Lint.
Errors Splint will detectErrors Splint will detect
• Dereferencing a possibly null pointer.
• Using possibly undefined storage or returning
storage that is not properly defined.
• Type mismatches, with greater precision and
flexibility than provided by C compilers.
• Violations of information hiding.
• Memory management errors including uses of
dangling references and memory leaks.
• Dangerous aliasing.
Errors Splint will detect continued…Errors Splint will detect continued…
• Modifications and global variable uses that
are inconsistent with specified interfaces.
• Problematic control flow such as likely
infinite loops.
• Buffer overflow vulnerabilities.
• Dangerous macro initializations and
invocations.
• Violations of customized naming
conventions.
What’s wrong with thisWhat’s wrong with this
code?code?
void strcpy(char* str1, char* str2)
{
while (str2 != 0)
{
*str1 = *str2;
str1++;
str2++;
}
str1 = 0; //null terminate the string
}
What happens to theWhat happens to the
stack?stack?
void foo()
{
char buff1[20]; char buff2[40];
…
//put some data into buff2
strcpy(buff1, buff2);
}
Secure ProgrammingSecure Programming
• Exploitable bugs such as buffer overflows in
software are the most costly bugs.
• Incredibly frequent because they are so hard to
catch.
• Analysis tools play a big part in finding and fixing
security holes in software.
How does Splint deal with falseHow does Splint deal with false
positives?positives?
• Splint supports annotations to the code that
document assumptions the programmer makes
about a given piece of code
• These annotations help limit false positives.
Run-time AnalysisRun-time Analysis
• Many bugs cannot be determined at compile
time. Run-time tools required to find these bugs.
• Run-time analysis tools work at run-time instead of
compile time.
PurifyPurify
• Purify modifies object files at link time.
• After execution, Purify will report bugs such as
memory leaks and null dereferences.
Purify continued…Purify continued…
• From the purify manual: “Purify checks every
memory access operation, pinpointing where
errors occur and providing diagnostic information
to help you analyze why the errors occur.”
Types of errors found byTypes of errors found by
PurifyPurify
• Reading or writing beyond the bounds of an array.
• Using un-initialized memory.
• Reading or writing freed memory.
• Reading or writing beyond the stack pointer.
• Reading or writing through null pointers.
• Leaking memory and file descriptors.
• Using a pointer whose memory location was just
deallocated
Static vs. Run-timeStatic vs. Run-time
AnalysisAnalysis
• Probably good to use both.
• Run-time analysis has fewer false positives, but
usually requires that a test harness test all possible
control flow paths.
Cons of Analysis ToolsCons of Analysis Tools
• Add time and effort to the development process.
• Lots of false positives.
• No guarantee of catching every bug.
• However, in a commercial situation, probably
worth your time to use these tools.
Other ToolsOther Tools
• Mallocdebug and debugmalloc libraries
• valgrind is a purify-like tool which can
really help track down memory
corruption (linux only)
• MemProf for memory profiling and leak
detection (linux only)
www.gnome.org/projects/memprof
• electric fence is a library which helps you
find memory errors
• c++filt demangles a mangled c++ name
Memory LeaksMemory Leaks
• Memory bugs
o Memory corruption: dangling refs, buffer overflows
o Memory leaks
• Lost objects: unreachable but not freed
• Useless objects: reachable but not used again
Memory LeaksMemory Leaks
• Memory bugs
o Memory corruption: dangling refs, buffer overflows
o Memory leaks
• Lost objects: unreachable but not freed
• Useless objects: reachable but not used again
Managed Languages
 80% of new software in Java or C# by 2010
[Gartner] (personally TB does not believe it..)
 Type safety & GC eliminate many bugs
Memory LeaksMemory Leaks
• Memory bugs
o Memory corruption: dangling refs, buffer overflows
o Memory leaks
• Lost objects: unreachable but not freed
• Useless objects: “reachable” but not used again
Managed Languages
 80% of new software in Java or C# by 2010
[Gartner]
 Type safety & GC eliminate many bugs
Memory LeaksMemory Leaks
• Memory bugs
o Memory corruption: dangling refs, buffer overflows
o Memory leaks
• Lost objects: unreachable but not freed
• Useless objects: reachable but not used again
Managed Languages
 80% of new software in Java or C# by 2010
[Gartner]
 Type safety & GC eliminate many bugs
Leaks occur in practice in managed languages [Cork, JRockit,
JProbe, LeakBot, .NET Memory Profiler]
Other linux ToolsOther linux Tools
• strace / truss / ktrace let you know what system
calls a process is making
• Data Display Debugger (DDD) is good for
visualizing your program data
www.gnu.org/software/ddd
• gcov lets you see which parts of your code are
getting executed
• Profilers (gprof) to see where you are spending
“time” which can help with performance logic
bugs
Code beautifierCode beautifier
• Improve indentation of your source code for better
readability
• source code beautifier in UNIX/Cygwin
o Indent
o M-x indent-region in emacs
• Make sure the code beautifier
does not change how your code
works after beautification!
Avoiding bugs in the firstAvoiding bugs in the first
placeplace
• Coding style: use clear, consistent style and useful naming
standards.
• Document everything, from architecture and interface
specification documents to comments on code lines.
• Hold code reviews.
• Program defensively.
• Use/implement exception handling liberally; think
constantly about anomalous conditions.
• Be suspicious of cut/paste.
• Consider using an integrated development environment
(IDE) with dynamic syntax checking
Code reviewsCode reviews
• Primary programmer(s) for some piece of code
presents and explains that code, line by line.
• Audience of programmers experienced in language,
code’s general domain. Audience may also contain
designers, testers, customers and others less versed in
code but concerned with quality and consistency.
• Review is a dialogue: audience pushes presenters to
reevaluate and rationalize their implementation
decisions.
• Extremely useful: reviews often turn up outright errors,
inconsistencies, inefficiencies and unconsidered
exceptional conditions.
• Also useful in familiarizing a project team with a
member’s code.
War StoriesWar Stories
Nasty ProblemsNasty Problems
• overwriting return address on the stack
• overwriting virtual function tables
• compiler bugs - rare but my students and I
have a talent for finding them
- try -O, -O2, -Os
• wrong version of a shared library gets loaded
- make the runtime linker be verbose
some fun (simple) bugssome fun (simple) bugs
o In java (or whatever):
public void foo(int p, int q) {
int x = p;
int y = p;
}
o In perl:
$foo = $cgi->param(‘foo’);
if (!$foo) {
webDie (“missing parameter foo!”);
}
o In C:
char *glue(char *left, char sep, char *right) {
char *buf = malloc(sizeof(char) *
(strlen(left) + 1 strlen(right)));
sprintf(buf, “%s%c%s”, left, sep, right);
return buf;
}
TricksTricks
• write a custom assert()
• stub routines on which to break
• dump to a file instead of standard out
• make rand() deterministic by controlling the seed
• fight memory corruption with tools that use
sentinels, etc. (and if no tools do it yourself)
The Future of DebuggingThe Future of Debugging
• better debuggers and programs to help you
visualize your programs state
• simple model checkers
• programs keep getting bigger, finding bugs is
going to get harder!
• Parallel/distributed debuggers as we move to more
parallel/distributed systems.
ThankThank You !!!You !!!
For More Information click below link:
Follow Us on:
http://vibranttechnologies.co.in/p

More Related Content

What's hot

Classification of debuggers sp
Classification of debuggers spClassification of debuggers sp
Classification of debuggers spShaishavShah8
 
Presentations Unusual Java Bugs And Detecting Them Using Foss Tools
Presentations Unusual Java Bugs And Detecting Them Using Foss ToolsPresentations Unusual Java Bugs And Detecting Them Using Foss Tools
Presentations Unusual Java Bugs And Detecting Them Using Foss ToolsGanesh Samarthyam
 
How to Manage the Risk of your Polyglot Environments
How to Manage the Risk of your Polyglot EnvironmentsHow to Manage the Risk of your Polyglot Environments
How to Manage the Risk of your Polyglot EnvironmentsDevOps.com
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at PyconJacqueline Kazil
 
Software Debugging for High-altitude Balloons
Software Debugging for High-altitude BalloonsSoftware Debugging for High-altitude Balloons
Software Debugging for High-altitude Balloonsjgrahamc
 
AATC2016: Exploratory testing an API
AATC2016: Exploratory testing an APIAATC2016: Exploratory testing an API
AATC2016: Exploratory testing an APIMaaret Pyhäjärvi
 
War of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlowWar of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlowPVS-Studio
 
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)brian d foy
 
How penetration testing techniques can help you improve your qa skills
How penetration testing techniques can help you improve your qa skillsHow penetration testing techniques can help you improve your qa skills
How penetration testing techniques can help you improve your qa skillsMarian Marinov
 
TestWorksConf: Experience exploratory testing
TestWorksConf: Experience exploratory testingTestWorksConf: Experience exploratory testing
TestWorksConf: Experience exploratory testingMaaret Pyhäjärvi
 
If you want to automate, you learn to code
If you want to automate, you learn to codeIf you want to automate, you learn to code
If you want to automate, you learn to codeAlan Richardson
 
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestStatic Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestDenim Group
 
Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604Alan Richardson
 
How to Improve Your Technical Test Ability - AADays 2015 Keynote
How to Improve Your Technical Test Ability - AADays 2015 KeynoteHow to Improve Your Technical Test Ability - AADays 2015 Keynote
How to Improve Your Technical Test Ability - AADays 2015 KeynoteAlan Richardson
 
Engineers need to learn UXR
Engineers need to learn UXREngineers need to learn UXR
Engineers need to learn UXRNeha Batra
 
Searching for bugs in Mono: there are hundreds of them!
Searching for bugs in Mono: there are hundreds of them!Searching for bugs in Mono: there are hundreds of them!
Searching for bugs in Mono: there are hundreds of them!PVS-Studio
 

What's hot (19)

Classification of debuggers sp
Classification of debuggers spClassification of debuggers sp
Classification of debuggers sp
 
Presentations Unusual Java Bugs And Detecting Them Using Foss Tools
Presentations Unusual Java Bugs And Detecting Them Using Foss ToolsPresentations Unusual Java Bugs And Detecting Them Using Foss Tools
Presentations Unusual Java Bugs And Detecting Them Using Foss Tools
 
How to Manage the Risk of your Polyglot Environments
How to Manage the Risk of your Polyglot EnvironmentsHow to Manage the Risk of your Polyglot Environments
How to Manage the Risk of your Polyglot Environments
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at Pycon
 
Software Debugging for High-altitude Balloons
Software Debugging for High-altitude BalloonsSoftware Debugging for High-altitude Balloons
Software Debugging for High-altitude Balloons
 
AATC2016: Exploratory testing an API
AATC2016: Exploratory testing an APIAATC2016: Exploratory testing an API
AATC2016: Exploratory testing an API
 
War of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlowWar of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlow
 
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
 
American Fuzzy Lop
American Fuzzy LopAmerican Fuzzy Lop
American Fuzzy Lop
 
How penetration testing techniques can help you improve your qa skills
How penetration testing techniques can help you improve your qa skillsHow penetration testing techniques can help you improve your qa skills
How penetration testing techniques can help you improve your qa skills
 
TestWorksConf: Experience exploratory testing
TestWorksConf: Experience exploratory testingTestWorksConf: Experience exploratory testing
TestWorksConf: Experience exploratory testing
 
If you want to automate, you learn to code
If you want to automate, you learn to codeIf you want to automate, you learn to code
If you want to automate, you learn to code
 
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestStatic Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
 
Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604
 
Exploratory testing
Exploratory testingExploratory testing
Exploratory testing
 
How to Improve Your Technical Test Ability - AADays 2015 Keynote
How to Improve Your Technical Test Ability - AADays 2015 KeynoteHow to Improve Your Technical Test Ability - AADays 2015 Keynote
How to Improve Your Technical Test Ability - AADays 2015 Keynote
 
Engineers need to learn UXR
Engineers need to learn UXREngineers need to learn UXR
Engineers need to learn UXR
 
Static code analysis
Static code analysisStatic code analysis
Static code analysis
 
Searching for bugs in Mono: there are hundreds of them!
Searching for bugs in Mono: there are hundreds of them!Searching for bugs in Mono: there are hundreds of them!
Searching for bugs in Mono: there are hundreds of them!
 

Similar to PHP Debugging Techniques

debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).pptjerlinS1
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...jeyasrig
 
Chelberg ptcuser 2010
Chelberg ptcuser 2010Chelberg ptcuser 2010
Chelberg ptcuser 2010Clay Helberg
 
Austin Python Learners Meetup - Everything you need to know about programming...
Austin Python Learners Meetup - Everything you need to know about programming...Austin Python Learners Meetup - Everything you need to know about programming...
Austin Python Learners Meetup - Everything you need to know about programming...Danny Mulligan
 
Topic production code
Topic production codeTopic production code
Topic production codeKavi Kumar
 
TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012Ashish Bhasin
 
Static-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxStatic-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxShivashankarHR1
 
Why Software Test Performance Matters
Why Software Test Performance MattersWhy Software Test Performance Matters
Why Software Test Performance MattersSolano Labs
 
Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do itMartin Sykora
 
Practical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbgPractical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbgSam Bowne
 
CNIT 126 Ch 9: OllyDbg
CNIT 126 Ch 9: OllyDbgCNIT 126 Ch 9: OllyDbg
CNIT 126 Ch 9: OllyDbgSam Bowne
 
Java Code Quality Tools
Java Code Quality ToolsJava Code Quality Tools
Java Code Quality ToolsAnju ML
 
Types of program testings and errors
Types of program testings and errorsTypes of program testings and errors
Types of program testings and errorsAmiirah Camall Saib
 
Achieving quality with tools case study
Achieving quality with tools case studyAchieving quality with tools case study
Achieving quality with tools case studyEosSoftware
 

Similar to PHP Debugging Techniques (20)

debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).ppt
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...
 
Chelberg ptcuser 2010
Chelberg ptcuser 2010Chelberg ptcuser 2010
Chelberg ptcuser 2010
 
Austin Python Learners Meetup - Everything you need to know about programming...
Austin Python Learners Meetup - Everything you need to know about programming...Austin Python Learners Meetup - Everything you need to know about programming...
Austin Python Learners Meetup - Everything you need to know about programming...
 
Bug Hunting Safari
Bug Hunting SafariBug Hunting Safari
Bug Hunting Safari
 
Debbuging
DebbugingDebbuging
Debbuging
 
Topic production code
Topic production codeTopic production code
Topic production code
 
Fp201 unit1 1
Fp201 unit1 1Fp201 unit1 1
Fp201 unit1 1
 
Java Code Quality Tools
Java Code Quality ToolsJava Code Quality Tools
Java Code Quality Tools
 
Debugging
DebuggingDebugging
Debugging
 
TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012
 
Static-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxStatic-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptx
 
Why Software Test Performance Matters
Why Software Test Performance MattersWhy Software Test Performance Matters
Why Software Test Performance Matters
 
Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do it
 
Practical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbgPractical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbg
 
CNIT 126 Ch 9: OllyDbg
CNIT 126 Ch 9: OllyDbgCNIT 126 Ch 9: OllyDbg
CNIT 126 Ch 9: OllyDbg
 
Java Code Quality Tools
Java Code Quality ToolsJava Code Quality Tools
Java Code Quality Tools
 
Types of program testings and errors
Types of program testings and errorsTypes of program testings and errors
Types of program testings and errors
 
Achieving quality with tools case study
Achieving quality with tools case studyAchieving quality with tools case study
Achieving quality with tools case study
 
Spaghetti gate
Spaghetti gateSpaghetti gate
Spaghetti gate
 

More from Vibrant Technologies & Computers

Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Vibrant Technologies & Computers
 

More from Vibrant Technologies & Computers (20)

Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
 
Data ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housingData ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housing
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
 
Sas - Introduction to designing the data mart
Sas - Introduction to designing the data martSas - Introduction to designing the data mart
Sas - Introduction to designing the data mart
 
Sas - Introduction to working under change management
Sas - Introduction to working under change managementSas - Introduction to working under change management
Sas - Introduction to working under change management
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
 

Recently uploaded

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

PHP Debugging Techniques

  • 1.
  • 2. Introduction to PHPIntroduction to PHP Bugs - DebuggingBugs - Debugging
  • 3. What You Won’t LearnWhat You Won’t Learn • how to solve all your problems • the one true way to avoid all bugs • Many platform specific debugging techniques
  • 4. DocumentationDocumentation • learn where the documentation for your system is and use it • when in doubt, look it up! - Internet is your friend, but many cluless people so must filter. Use definitive sources if you can - man pages/Info system for Unix systems - MSDN for windows - javadoc for Java libraries - /Developer/Documentation for Mac OS X
  • 5. DebuggingDebugging • Debugging is a black art. Some things to go over, though, so they’ll be concrete in our brains: o relation to testing o why debugging is hard o types of bugs o process o techniques o tools o avoiding bugs
  • 6. Debugging and testingDebugging and testing • Testing and debugging go together like peas in a pod: o Testing finds errors; debugging localizes and repairs them. o Together these form the “testing/debugging cycle”: we test, then debug, then repeat. o Any debugging should be followed by a reapplication of all relevant tests, particularly regression tests. This avoids (reduces) the introduction of new bugs when debugging. o Testing and debugging need not be done by the same people (and often should not be).
  • 7. Why debugging is hardWhy debugging is hard • There may be no obvious relationship between the external manifestation(s) of an error and its internal cause(s). • Symptom and cause may be in remote parts of the program. • Changes (new features, bug fixes) in program may mask (or modify) bugs. • Symptom may be due to human mistake or misunderstanding that is difficult to trace. • Bug may be triggered by rare or difficult to reproduce input sequence, program timing (threads) or other external causes. • Bug may depend on other software/system state, things others did to you systems weeks/months ago.
  • 8. Designing for Debug/TestDesigning for Debug/Test • when you write code think about how you are going to test/debug it - lack of thought always translates into bugs • write test cases when you write your code • if something should be true assert() it • create functions to help visualize your data • design for testing/debugging from the start • test early, test often • test at abstraction boundaries
  • 9. Fault InjectionFault Injection • many bugs only happen in the uncommon case • make this case more common having switches that cause routines to fail - file open, file write, memory allocation, are all good candidates - Have “test drivers” which test with the uncommon data. If deeply buried, test with a debugger script
  • 10. Finding and Fixing BugsFinding and Fixing Bugs • in order to create quality software you need to find your bugs - testing - user reports • the best bugs are those that are always reproducible
  • 11. Types of bugsTypes of bugs • Types of bugs (gotta love em): o Compile time: syntax, spelling, static type mismatch. • Usually caught with compiler o Design: flawed algorithm. • Incorrect outputs o Program logic (if/else, loop termination, select case, etc). • Incorrect outputs o Memory nonsense: null pointers, array bounds, bad types, leaks. • Runtime exceptions o Interface errors between modules, threads, programs (in particular, with shared resources: sockets, files, memory, etc). • Runtime Exceptions o Off-nominal conditions: failure of some part of software of underlying machinery (network, etc). • Incomplete functionality o Deadlocks: multiple processes fighting for a resource. • Freeze ups, never ending processes
  • 12. The ideal debuggingThe ideal debugging processprocess • A debugging algorithm for software engineers: o Identify test case(s) that reliably show existence of fault (when possible) o Isolate problem to small fragment(s) of program o Correlate incorrect behavior with program logic/code error o Change the program (and check for other parts of program where same or similar program logic may also occur) o Regression test to verify that the error has really been removed - without inserting new errors o Update documentation when appropriate (Not all these steps need be done by the same person!)
  • 13. General AdviceGeneral Advice • try to understand as much of what is happening as possible • “it compiles” is NOT the same as “it works” • when in doubt, ask. Then test the answer! • Error messages are generally just a vague hint and can be misleading. • Don’t always trust the “comments/documents”, they can be out- of-date.
  • 14. What is a Debugger?What is a Debugger? “A software tool that is used to detect the source of program or script errors, by performing step-by-step execution of application code and viewing the content of code variables.” -MSDN
  • 15. What is a Debugger?What is a Debugger? (con't)(con't) • A debugger is not an IDE o Though the two can be integrated, they are separate entities. • A debugger loads in a program (compiled executable, or interpreted source code) and allows the user to trace through the execution. • Debuggers typically can do disassembly, stack traces, expression watches, and more.
  • 16. Why use a Debugger?Why use a Debugger? • No need for precognition of what the error might be. • Flexible o Allows for “live” error checking – no need to re-write and re-compile when you realize a certain type of error may be occuring o Dynamic o Can view the entire relevant scope
  • 17. Why people don’tWhy people don’t use a Debugger?use a Debugger? • With simple errors, may not want to bother with starting up the debugger environment. o Obvious error o Simple to check using prints/asserts • Hard-to-use debugger environment • Error occurs in optimized code • Changes execution of program (error doesn’t occur while running debugger)
  • 18. Debugging techniques, 1Debugging techniques, 1 • Execution tracing o running the program o print o trace utilities o single stepping in debugger o hand simulation
  • 19. Debugging techniques, 2Debugging techniques, 2 • Interface checking o check procedure parameter number/type (if not enforced by compiler) and value o defensive programming: check inputs/results from other modules o documents assumptions about caller/callee relationships in modules, communication protocols, etc • Assertions: include range constraints or other information with data. • Skipping code: comment out suspect code, then check if error remains.
  • 20. Other Functions of aOther Functions of a DebuggerDebugger • Disassembly (in context and with live data!) • Execution Tracing/Stack tracing • Symbol watches
  • 21. DisassemblyDisassembly • Most basic form of debugging • Translating machine code into assembly instructions that are more easily understood by the user. • Typically implementable as a simple lookup table • No higher-level information (variable names, etc.) • Relatively easy to implement.
  • 22. Execution TracingExecution Tracing • Follows the program through the execution. Users can step through line-by-line, or use breakpoints. • Typically allows for “watches” on – registers, memory locations, symbols • Allows for tracing up the stack of runtime errors (back traces) • Allows user to trace the causes of unexpected behavior and fix them
  • 23. Symbol InformationSymbol Information • Problem – a compiler/assembler translates variable names and other symbols into internally consistent memory addresses • How does a debugger know which location is denoted by a particular symbol? • We need a “debug” executable.
  • 24. Debug vs. Release BuildsDebug vs. Release Builds • Debug builds usually are not optimized • Debug executables contain: o program's symbol tables o location of the source file o line number tags for assembly instructions. • GCC/GDB allows debugging of optimized code.
  • 25. Bug hunting with print • Weak form of debugging, but still common • How bug hunting with print can be made more useful: – print variables other than just those you think suspect. – print valuable statements (not just “hin”). – use exit() to concentrate on a part of a program. – move print through a through program to track down a bug.
  • 26. Debugging with print (continued) • Building debugging with print into a program (more common/valuable): – print messages, variables/test results in useful places throughout program. – use a ‘debug’ or ‘debug_level’ global flag to turn debugging messages on or off, or change “levels” – possibly use a source file preprocessor (#ifdef) to insert/remove debug statements. – Often part of “regression testing” so automated scripts can test output of many things at once.
  • 27. Finding ReproducibleFinding Reproducible BugsBugs • a bug happens when there is a mismatch between what you (someone) think is happening and what is actually happening • confirm things you believe are true • narrow down the causes one by one • make sure you understand your program state • keep a log of events and assumptions
  • 28. Finding ReproducibleFinding Reproducible BugsBugs • try explaining what should be happing - Verbalization/writing often clarifies muddled thoughts • have a friend do a quick sanity check • don’t randomly change things, your actions should have a purpose. o If you are not willing to check it into CVS with a log that your boss may read, then you are not ready to make that change to the code. o Think it through first, both locally and globally.
  • 29. (semi) irreproducible(semi) irreproducible bugsbugs • sometimes undesired behavior only happens sporadically • tracking down these heisenbugs is hard • the error could be a any level - Circuits (e.g. bad ram chip at high memory address) - compiler - os - Linker - Irreproducible external “data” and timing
  • 30. Finding HeisenBugsFinding HeisenBugs • Use good tools like Purify. Most common “Heisenbugs” are memory or thread related. • try to make the bug reproducible by switching platforms/libraries/compilers • insert checks for invariants and have the program stop everything when one is violated • verify each layer with small, simple tests • find the smallest system which demonstrates the bug • Test with “canned data”, replayed over net if needed.
  • 31. Timing and ThreadingTiming and Threading BugsBugs • ensure the functionality works for a single thread • if adding a printf() removes the bug it is almost certainly a timing/threading bug or a trashed memory bug • try using coarse grained locking to narrow down the objects involved • try keeping an event (transaction) log
  • 32. Memory Bugs and Buffer OverflowMemory Bugs and Buffer Overflow • Trashing stack/heap causes often difficult to find bugs. • Manifestation can be far from actual bug. o “Free list” information generally stored just after a “malloced” chunck of data. Overwriting may not cause problem until data is “freed”, or until something else does a malloc after the free. o Stack variables, overwriting past end, changes other variables, sometimes return address. (Buffer overflow) o Bad “string” ops notorious, using input data can also be problematic.
  • 33. An example….An example…. void myinit(int startindex, int startvalue, int length, int* vect){ int i; for(i=startindex; i< startindex+length; i++) *vect++ = startvalue++; } void whattheheck(){ printf("How did I ever get here????n"); exit(2); } int main(int argc, char**argv){ float d; int a,b[10],c, i, start,end; if(argc != 3) {printf("Usage:%s start, endn",argv[0]);exit(-1); } start=atoi(argv[1]); end=atoi(argv[2]); /* bad style but shorter */ a=0; c=0; d=3.14159; /* bad style but shorter */ printf("Initally a %d, c %d, d %f, start %d, end %dn",a,c,d, start,end); myinit(start,start,end,b+start); printf("finally a %d, c %d, d %f start %d, end %d n",a,c,d, start, end); if(end>10) b[end-1]=134513723; return 0; }
  • 34. Debugging TechniquesDebugging Techniques • methodology is key • knowing about lots of debugging tools helps • the most critical tool in your arsenal is your brain • second most important tool is a debugger o Core dumps are your friends.. Learn how to use them. • Memory debugging tools third most important • Profiler fourth
  • 35. ToolsTools • Tracing programs: o strace, truss (print out system calls), o /bin/bash –X to get a shell script to say what its doing • Command-line debuggers : o gdb (C, C++), jdb (java), “perl -d” • Random stuff: o electric fence or malloc_debug, mtrace, etc (a specialized malloc() for finding memory leaks in C/C++) o purify (Part of Rational Suite, a really good memory debugging tools for C/C++ programs)
  • 36. DebuggersDebuggers • allow programs to inspect the state of a running program • become more important when debugging graphical or complex applications • jdb and gjdb for java • gdb for C/C++ programs on unix/Max • MSVS for Win32 • kdb for the linux kernel
  • 37. Using gdbUsing gdb • Compile debugging information into your program: gcc -g <program> • Read the manual: o man gdb oin emacs (tex-info): http://www.cslab.vt.edu/manuals/gdb/gdb_toc.html M-x help <return> i <return>, arrow to GDB, <return> oonline:
  • 38. gdb comandsgdb comands run/continue/next/step: start the program, continue running until break, next line (don’t step into subroutines), next line (step into subroutines). break <name>: set a break point on the named subroutine. Debugger will halt program execution when subroutine called. backtrace: print a stack trace. print <expr>: execute expression in the current program state, and print results (expression may contain assignments, function calls). help: print the help menu. help <subject> prints a subject menu. quit: exit gdb.
  • 39. General GDBGeneral GDB • easiest to use inside of emacs (M-x gdb) • run starts the program • set args controls the arguments to the program • breakpoints control where the debugger stops the program (set with C-x space) • next moves one step forward • step moves one step forward and also traverses function calls • continue runs the program until the next breakpoint
  • 40. General GDBGeneral GDB • p prints a value (can be formated) - /x hex - /o octal - /t binary (t is for two) - /f float - /u unsigned decimal
  • 41. General GDBGeneral GDB • bt shows the current backtrace (also where) • up/down move up down the stack • f # lets you switch to frame # in the current backtrace • set var=value • call allows call of a function (the syntax can get funky) • jump (dump to a particular line of code) • Thread # lets you switch to a particular thread
  • 42. Advanced GDBAdvanced GDB • watchpoints let you check if an expression changes • catchpoints let you know when interesting things like exec calls or library loads happen • x lets you inspect the contents of memory • Watchpoints can be quite slow, best to combine with breakpoints.
  • 43. Advanced GDBAdvanced GDB • gcc 3.1 and up provides macro information to gdb if you specify the options -gdwardf2 and -g3 on the command line • you can debug and already running process with the attach pid command • you can apply a GDB command to all threads with thread apply all • GDB can be used to debug remote embedded systems (gdbserver, etc..)
  • 44. The example in gdbThe example in gdb void myinit(int startindex, int startvalue, int length, int* vect){ int i; for(i=startindex; i< startindex+length; i++) *vect++ = startvalue++; } void whattheheck(){ printf("How did I ever get here????n"); exit(2); } int main(int argc, char**argv){ float d; int a,b[10],c, i, start,end; if(argc != 3) {printf("Usage:%s start, endn",argv[0]);exit(-1); } start=atoi(argv[1]); end=atoi(argv[2]); /* bad style but shorter */ a=0; c=0; d=3.14159; /* bad style but shorter */ printf("Initally a %d, c %d, d %f, start %d, end %dn",a,c,d, start,end); myinit(start,start,end,b+start); printf("finally a %d, c %d, d %f start %d, end %d n",a,c,d, start, end); if(end>10) b[end-1]=134513723; return 0; }
  • 45. JDBJDB • Compile your source file with -g option o Produce debugging information o For example javac –g rsdimu.java • To run jdb, o Type “jdb”, use run command to load an executable • run <class name> • For example, run rsdimu o OR type “jdb <class name>, then • Type “run” to execute the program o Type “quit” to exit jdb
  • 46. BreakpointBreakpoint • Make your program stops whenever a certain point in the program is reached • For example o Make a breakpoint in line 6 stop at Demo:6 o Program stops before execute line 6 o Allow you to examine code, variables, etc. public class Demo { public static void main(…) { System.out.println(“An”); System.out.println(“Bn”); System.out.println(“Cn”); } } 1 2 3 4 5 6 7 8 9
  • 47. BreakpointBreakpoint • Add breakpoint o stop at MyClass:<line num> o stop in java.lang.String.length o stop in MyClass.<method name> • Delete breakpoint o clear (clear all breakpoints) o clear <breakpoint> • e.g. clear MyClasss:22
  • 48. StepStep • Execute one source line, then stop and return to JDB • Example public void func() { System.out.println(“An”); System.out.println(“Bn”); System.out.println(“Cn”); return 0; } public void func() { System.out.println(“An”); System.out.println(“Bn”); System.out.println(“Cn”); return 0; } step
  • 49. NextNext • Similar to step, but treat function call as one source line • Example next public void func1() { println(“Bn”); println(“Cn”); } public void func() { println(“An”); func1(); return 0; } public void func1() { println(“Bn”); println(“Cn”); } public void func() { println(“An”); func1(); return 0; } step
  • 50. ContCont • Resume continuous execution of the program until either one of the followings o Next breakpoint o End of program
  • 51. PrintPrint • Print o Display the value of an expression • print expression o print MyClass.myStaticField o print i + j + k o print myObj.myMethod() (if myMethod returns a non-null) o print new java.lang.String("Hello").length() • Dump o Display all the content of an object • dump <object>
  • 53. Purpose of Analysis ToolsPurpose of Analysis Tools • Need for a feasible method to catch bugs in large projects. Formal verification techniques require unreasonable effort on large projects. • Augment traditional debugging techniques without adding unreasonable burden to the development process.
  • 54.
  • 55. Two Types of AnalysisTwo Types of Analysis ToolsTools • Static Analysis • Run-time (dynamic) Analysis
  • 56. SplintSplint • Open Source Static Analysis Tool developed at U.Va by Professor Dave Evans. • Based on Lint.
  • 57. Errors Splint will detectErrors Splint will detect • Dereferencing a possibly null pointer. • Using possibly undefined storage or returning storage that is not properly defined. • Type mismatches, with greater precision and flexibility than provided by C compilers. • Violations of information hiding. • Memory management errors including uses of dangling references and memory leaks. • Dangerous aliasing.
  • 58. Errors Splint will detect continued…Errors Splint will detect continued… • Modifications and global variable uses that are inconsistent with specified interfaces. • Problematic control flow such as likely infinite loops. • Buffer overflow vulnerabilities. • Dangerous macro initializations and invocations. • Violations of customized naming conventions.
  • 59. What’s wrong with thisWhat’s wrong with this code?code? void strcpy(char* str1, char* str2) { while (str2 != 0) { *str1 = *str2; str1++; str2++; } str1 = 0; //null terminate the string }
  • 60. What happens to theWhat happens to the stack?stack? void foo() { char buff1[20]; char buff2[40]; … //put some data into buff2 strcpy(buff1, buff2); }
  • 61. Secure ProgrammingSecure Programming • Exploitable bugs such as buffer overflows in software are the most costly bugs. • Incredibly frequent because they are so hard to catch. • Analysis tools play a big part in finding and fixing security holes in software.
  • 62. How does Splint deal with falseHow does Splint deal with false positives?positives? • Splint supports annotations to the code that document assumptions the programmer makes about a given piece of code • These annotations help limit false positives.
  • 63. Run-time AnalysisRun-time Analysis • Many bugs cannot be determined at compile time. Run-time tools required to find these bugs. • Run-time analysis tools work at run-time instead of compile time.
  • 64. PurifyPurify • Purify modifies object files at link time. • After execution, Purify will report bugs such as memory leaks and null dereferences.
  • 65. Purify continued…Purify continued… • From the purify manual: “Purify checks every memory access operation, pinpointing where errors occur and providing diagnostic information to help you analyze why the errors occur.”
  • 66. Types of errors found byTypes of errors found by PurifyPurify • Reading or writing beyond the bounds of an array. • Using un-initialized memory. • Reading or writing freed memory. • Reading or writing beyond the stack pointer. • Reading or writing through null pointers. • Leaking memory and file descriptors. • Using a pointer whose memory location was just deallocated
  • 67. Static vs. Run-timeStatic vs. Run-time AnalysisAnalysis • Probably good to use both. • Run-time analysis has fewer false positives, but usually requires that a test harness test all possible control flow paths.
  • 68. Cons of Analysis ToolsCons of Analysis Tools • Add time and effort to the development process. • Lots of false positives. • No guarantee of catching every bug. • However, in a commercial situation, probably worth your time to use these tools.
  • 69. Other ToolsOther Tools • Mallocdebug and debugmalloc libraries • valgrind is a purify-like tool which can really help track down memory corruption (linux only) • MemProf for memory profiling and leak detection (linux only) www.gnome.org/projects/memprof • electric fence is a library which helps you find memory errors • c++filt demangles a mangled c++ name
  • 70. Memory LeaksMemory Leaks • Memory bugs o Memory corruption: dangling refs, buffer overflows o Memory leaks • Lost objects: unreachable but not freed • Useless objects: reachable but not used again
  • 71. Memory LeaksMemory Leaks • Memory bugs o Memory corruption: dangling refs, buffer overflows o Memory leaks • Lost objects: unreachable but not freed • Useless objects: reachable but not used again Managed Languages  80% of new software in Java or C# by 2010 [Gartner] (personally TB does not believe it..)  Type safety & GC eliminate many bugs
  • 72. Memory LeaksMemory Leaks • Memory bugs o Memory corruption: dangling refs, buffer overflows o Memory leaks • Lost objects: unreachable but not freed • Useless objects: “reachable” but not used again Managed Languages  80% of new software in Java or C# by 2010 [Gartner]  Type safety & GC eliminate many bugs
  • 73. Memory LeaksMemory Leaks • Memory bugs o Memory corruption: dangling refs, buffer overflows o Memory leaks • Lost objects: unreachable but not freed • Useless objects: reachable but not used again Managed Languages  80% of new software in Java or C# by 2010 [Gartner]  Type safety & GC eliminate many bugs Leaks occur in practice in managed languages [Cork, JRockit, JProbe, LeakBot, .NET Memory Profiler]
  • 74. Other linux ToolsOther linux Tools • strace / truss / ktrace let you know what system calls a process is making • Data Display Debugger (DDD) is good for visualizing your program data www.gnu.org/software/ddd • gcov lets you see which parts of your code are getting executed • Profilers (gprof) to see where you are spending “time” which can help with performance logic bugs
  • 75. Code beautifierCode beautifier • Improve indentation of your source code for better readability • source code beautifier in UNIX/Cygwin o Indent o M-x indent-region in emacs • Make sure the code beautifier does not change how your code works after beautification!
  • 76. Avoiding bugs in the firstAvoiding bugs in the first placeplace • Coding style: use clear, consistent style and useful naming standards. • Document everything, from architecture and interface specification documents to comments on code lines. • Hold code reviews. • Program defensively. • Use/implement exception handling liberally; think constantly about anomalous conditions. • Be suspicious of cut/paste. • Consider using an integrated development environment (IDE) with dynamic syntax checking
  • 77. Code reviewsCode reviews • Primary programmer(s) for some piece of code presents and explains that code, line by line. • Audience of programmers experienced in language, code’s general domain. Audience may also contain designers, testers, customers and others less versed in code but concerned with quality and consistency. • Review is a dialogue: audience pushes presenters to reevaluate and rationalize their implementation decisions. • Extremely useful: reviews often turn up outright errors, inconsistencies, inefficiencies and unconsidered exceptional conditions. • Also useful in familiarizing a project team with a member’s code.
  • 79. Nasty ProblemsNasty Problems • overwriting return address on the stack • overwriting virtual function tables • compiler bugs - rare but my students and I have a talent for finding them - try -O, -O2, -Os • wrong version of a shared library gets loaded - make the runtime linker be verbose
  • 80. some fun (simple) bugssome fun (simple) bugs o In java (or whatever): public void foo(int p, int q) { int x = p; int y = p; } o In perl: $foo = $cgi->param(‘foo’); if (!$foo) { webDie (“missing parameter foo!”); } o In C: char *glue(char *left, char sep, char *right) { char *buf = malloc(sizeof(char) * (strlen(left) + 1 strlen(right))); sprintf(buf, “%s%c%s”, left, sep, right); return buf; }
  • 81. TricksTricks • write a custom assert() • stub routines on which to break • dump to a file instead of standard out • make rand() deterministic by controlling the seed • fight memory corruption with tools that use sentinels, etc. (and if no tools do it yourself)
  • 82. The Future of DebuggingThe Future of Debugging • better debuggers and programs to help you visualize your programs state • simple model checkers • programs keep getting bigger, finding bugs is going to get harder! • Parallel/distributed debuggers as we move to more parallel/distributed systems.
  • 83. ThankThank You !!!You !!! For More Information click below link: Follow Us on: http://vibranttechnologies.co.in/p

Editor's Notes

  1. Talk about why the features are useful and point them towards documentation. Do not run an example here as it’s too hard to motivate.
  2. Again, simply motivate the functions here. Mention more about the GDB threading facilities.