In this thesis, we propose a lightweight debugging tool named EcoDB for resource-constrained wireless sensor platforms. EcoDB runs a simulator and a source-level debugger simultaneously. We use both the simulator and the source-level debugger to provide the information that the developer of the system needs to diagnose the problem, and we provide the option to save the traced output to a Micro-SD card to eliminate the overhead of data communication. EcoDB minimize its side effects on the program being debugged. As a result, EcoDB requires 689 bytes of data memory and 135 bytes of program memory and does not alter functional behavior or energy usage of the original WSN application program.