DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Scripting: The Debugger Shell, Getting Started…

Scripting: The Debugger Shell, Getting Started…

Erich Styger user avatar by
Erich Styger
·
Apr. 30, 12 · Java Zone · Interview
Like (0)
Save
Tweet
7.90K Views

Join the DZone community and get the full member experience.

Join For Free

(this is the first in an occasional series around the scripting in eclipse and codewarrior. post a comment – let me know what you think!)

writing code should be fun, and debugging it is just a necessity because i rarely get it right the first time. eclipse with its gui is a great thing, and so is a command line interface. luckily the codewarrior eclipse engineers have added that kind of tool for the codewarrior debugger: the debugger shell as command line debugger using the tcl scripting language. this gives me a powerful way to deal with the embedded target board: from basic access to memory, to stepping and controlling the execution up to programming the flash memory.

the debugger shell is available from the window > show view menu:

show view: debugger shell

show view: debugger shell

a good command to use is help . this lists the built-in commands:

help command

help command

it has an auto-completion feature as well: start typing a command and then press tab : this will show all matching commands with the syntax:

quick help

quick help

most commands have as well a short version: so i can type help or just h . that saves me some writing time. additionally i can use the cursor keys to go up and down my command history.

if i default launch configuration, i simply use the debug command:

%>debug
launching {1}: 0% complete 
: 0% complete 
: 7% complete 
launching application: 7% complete 
creating debug session: 7% complete 
launching executable: 7% complete 
preparing executable: 7% complete 
loading symbolic information: 7% complete 
finished loading symbolic information: 7% complete 
preparing executable: 7% complete 
thread break: stopped, 0x0, 0x0, cpu68k, test_uiwidgets.elf (state, tid, pid, cpu, target) 
thread set: stopped, 0x0, 0x0, cpu68k, test_uiwidgets.elf (state, tid, pid, cpu, target) 
downloading 14468 bytes...: 7% complete 
download using 3rd party component...: 7% complete 
download using 3rd party component...: 100% complete 
thread break: stopped, 0x0, 0x0, cpu68k, test_uiwidgets.elf (state, tid, pid, cpu, target)

but how to know which one is the default launch configuration? there is the launch command which tells this:

%>launch
 *>0 - test_uiwidgets_mcf51jm128_internal_flash_pne u-multilink [codewarrior download] 
   1 - twr-lcd jm128 bootloader pne [codewarrior download] 
   2 - attach fslbot mcf52259_internal_flash [codewarrior attach] 
   3 - tower mcf52259 hotsync [codewarrior attach]

the line item with the star (*) denotes my current default launch configuration. knowing the list of launches, i can use any index to debug a project:

%>debug 1

or i can use the name:

%>debug "twr-lcd jm128 bootloader pne"

terminating or killing the debug session is simple using the kill command:

%>kill
thread exit: stopped, 0x0, 0x0, cpu68k, twr-lcdbootloader.elf (state, tid, pid, cpu, target)

stepping is easy: step asm or stepi steps an assembly instruction:

%>step asm
%>stepi

there are as well stepping instruction to step over , step into or step out of a function:

%>step into
%>step over
%>step out

to set a breakpoint, i use the bp command. using bp without argument will list my breakpoints as well.

%>bp main
  id  instance       address   type  enabled?  process  description 
  #5        #1  m:0x00002f86  -auto  enabled        $0  processorexpert.c, line 53, main [twr-lcdbootloader.elf]

to resume the application, i use the command go :

%>go

if it does not hit a breakpoint, i use stop to halt the target:

%>stop

to inspect my variables, i use the var command:

%>var filestatus
$00         
%>var bl_flasherased
$01

and to inspect the memory, i use the mem command:

%>mem 0x00800874 16
    800874  $0000177a $00002f84 $00002f98 $00002c8a   z... ./.. ./.. .,..  
    800884  $00000000 $00002c9c $00000000 $65000c03   .... .,.. .... ...e  
    800894  $4a004d00 $31003200 $3800001e $45ff0000   .m.j .2.1 ...8 ...e  
    8008a4  $0200eb3c $904d5344 $4f53352e $30000220   <... dsm. .5so  ..0

ok, that’s enough for now. this allows me to do all the basic debugging.

next time i’m going to explore how i can script a debug session. i want to automate things. the goal is to use scripts for unit tests using the debugger shell.

happy shell debugging :-)

shell Command (computing)

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Five Tips to Fasten Your Skewed Joins in Apache Spark
  • Dynamically Provisioning Persistent Volumes with Kubernetes
  • How to Modify Java Command-Line Arguments
  • How to Build Security for Your SaaS User Communications

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo