On Debugging Real-Time Applications F rank Mueller and David Whalley FSU Depa rtment of Computer Science DEPARTMENT OF COMPUTER SCIENCE Flo rida State Universit y T allahassee, FL 32304-4019 e-mail: mueller@cs.fsu.edu whalley@cs.fsu.edu On Debugging Real-Time Applications LCTS'94 1
Overview � debugging pa rt of development cycle (up to 50% of time) � few debuggers address real-time issues: - deadline monito ring - time disto rtion due to interference of debugging FSU DEPARTMENT OF COMPUTER SCIENCE � new debugging environment: - cache simulation to k eep track of elapsed cycles - displa ys elapsed execution time (cycles) - w o rks without changing debugger - slo ws do wn execution b y facto r of 1-4 - much faster than ha rdw a re simulato rs - to �nd missed deadlines - to lo cate time-consuming co de p o rtions On Debugging Real-Time Applications LCTS'94 2
Problems with Real-Time Debugging � time disto rtion: FSU DEPARTMENT OF COMPUTER SCIENCE - interference: b reakp oints, debugger k ernel traps, caching - replace real time with virtual time - external events simulated � deadline monito ring and task tuning � uni- vs. multi-p ro cesso r On Debugging Real-Time Applications LCTS'94 3
Overview of Debugging Environment FSU DEPARTMENT OF COMPUTER SCIENCE time estimation routines source- executable source object linker compiler level files files program debugger cache configuration On Debugging Real-Time Applications LCTS'94 4 control static instruction flow cache annotation simulator information
Real-Time Debugging Environment � elapsed time tracing: - query during debugging (any b reakp oint) FSU - calculate based on cache hit and misses simulated so fa r DEPARTMENT OF COMPUTER SCIENCE - can translate numb er of cycles into seconds � debugging optimized co de: - allo ws realistic timing simulation - restricts debugging to basic blo cks (b reakp oints) - can also displa y most va riables in registers - sometimes inconsistent values (due to optimizations) On Debugging Real-Time Applications LCTS'94 5
Sample Session with dbx (dbx) stop at 43 (dbx) stop at 123 if elapsed_cycles() > 4000000 (dbx) display elapsed_cycles() [...] stopped in four at line 43 FSU 43 mmax=2; DEPARTMENT OF COMPUTER SCIENCE elapsed_cycles() = 29413 (dbx) next stopped in four at line 44 44 while(n>mmax) { elapsed_cycles() = 29428 [...] 123 four(tdata,nn,isign); elapsed_cycles() = 4015629 [...] elapsed cycles() = 4095351 execution completed, exit code is 1 On Debugging Real-Time Applications LCTS'94 6
F rank Mueller and David Whalley LCTS'94 � b reak after 4 million cycles � displa y elapsed time � b reakp oints do not a�ect virtual time k eeping � deadline missed after 4+ million cycles (p oints to a rea where it's misses) � p rogram terminated even later � could set b reakp oint at inner nesting level next to lo calize missed deadline On Debugging Real-Time Applications (notes) 6-1
P erfo rmance Overhead FSU DEPARTMENT OF COMPUTER SCIENCE unopt. opt. co de with time estimates co de 1kB 2kB 4kB 8kB 1.8 7.8 4.5 3.0 2.1 On Debugging Real-Time Applications LCTS'94 7
F rank Mueller and David Whalley LCTS'94 � implemented on SP ARC � mo di�ed VPO � used db x under SunOS 4.1.3 � veri�ed co rrectness of instruction cache simulation b y compa ring with trace-driven simulation � 11 test p rograms � unopt. ab out 1.8 times slo w er than opt. co de � instr. opt. ab out 2.1 to 7.8 times slo w er than opt. co de � instr. opt. ab out 1 to 4 times slo w er than common unopt. co de � cache size in�uences overhead (due to con�icts) On Debugging Real-Time Applications (notes) 7-1
F uture W o rk � external event table FSU DEPARTMENT OF COMPUTER SCIENCE � pragma zero imetoinser tnon � t intr usiv edebug g ing codeextendtodata caching ; pipel ining � to b e used with Pthreads real-time k ernel on SP ARC VME b oa rd � p ro�ling with timing info rmation On Debugging Real-Time Applications LCTS'94 8
Related W o rk � debugging capabilities t ypically very restricted FSU DEPARTMENT OF COMPUTER SCIENCE � Remedy: interface, susp end all p ro cesso rs on b reakp oint � DCT: sp ecial ha rdw a re (bus monito ring), non-intrusive � RED, ART: soft w a re instrumentation, remote debugging � D ARTS: (1) p rogram trace (2) debug time-stamp ed trace � ha rdw a re simulato rs: very slo w On Debugging Real-Time Applications LCTS'94 9
F rank Mueller and David Whalley LCTS'94 � debugging remote, indirect (o�-line), not within p rogram � Remedy: � DCT: Distributed computing testb ed � RED: Remotely executed debugger � ART: instrumentation p ermanent pa rt of p rograms � D ARTS: Debug assistant fo r RTSs, no data queries On Debugging Real-Time Applications (notes) 9-1
Summa ry � develop ed new debugging enhancement fo r real-time � replace real time with virtual time � k eep track of virtual time b y instruction cache simulation FSU DEPARTMENT OF COMPUTER SCIENCE � feasible through static cache simulation � debug unoptimized o r optimized co de � displa y time rep eatedly at b reakp oints � �nd missed deadlines through conditional b reakp oints � lo cate time-consuming co de, tune it � tuning ma y b e used to mak e schedule feasible � p erfo rmance overhead of facto r 1 to 4 over unoptimized co de On Debugging Real-Time Applications LCTS'94 10
Recommend
More recommend