mdb: the microchip command-line debugger · july 2013 mdb: the microchip command-line debugger a...

32
July 2013 MDB: The Microchip Command-line Debugger A look at the command-line interface to Microchip's debuggers Friday, 9 August 13

Upload: doannhu

Post on 02-Apr-2018

225 views

Category:

Documents


4 download

TRANSCRIPT

July 2013

MDB: The Microchip Command-line Debugger

A look at the command-line interface to Microchip's debuggers

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 2

What is the MDB?

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 2

What is the MDB?

MDB allows access to Microchip debuggers from a terminal or console

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 2

What is the MDB?

MDB allows access to Microchip debuggers from a terminal or console

It can be faster than the IDE for some projects

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 2

What is the MDB?

MDB allows access to Microchip debuggers from a terminal or console

It can be faster than the IDE for some projects It can be run from scripts to automate

repetitive tasks

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 2

What is the MDB?

MDB allows access to Microchip debuggers from a terminal or console

It can be faster than the IDE for some projects It can be run from scripts to automate

repetitive tasks Run the shell or batch file to invoke it

(mdb.sh or mdb.bat)

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 2

What is the MDB?

MDB allows access to Microchip debuggers from a terminal or console

It can be faster than the IDE for some projects It can be run from scripts to automate

repetitive tasks Run the shell or batch file to invoke it

(mdb.sh or mdb.bat) Uses a syntax similar to the GNU debugger

(GDB)

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 3

Execution and Help

Friday, 9 August 13

Run mdb script provided

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 3

Execution and Help

Friday, 9 August 13

Run mdb script provided

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 3

Execution and Help

Operating System

Path

Windows c:\Program Files\Microchip\MPLABX\mplab_ide\bin\mdb.bat

Apple OS X /Applications/microchip/mplabx/mplab_ide.app/Contents/Resources/mplab_ide/bin/mdb.sh

Linux /opt/microchip/mplabx/mplab_ide/bin/mdb.sh

Friday, 9 August 13

Run mdb script provided

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 3

Execution and Help

Friday, 9 August 13

Run mdb script provided Type help for assistance with commands

Use a category or command name for detailed help

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 3

Execution and Help

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 4

Basic Use

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 4

Basic Use≈ 6: void putch(char data) 7: { 8: while( ! TXIF) // check buffer 9: continue; // wait till ready 10: TXREG = data; // send data 11: } 12: 13: unsigned char 14: update(unsigned char cnt) 15: { 16: return cnt - 2; 17: } 18: 19: int main(void) 20: { 21: unsigned char count;≈ 29: putch('\n'); 30: for(count=10; count!=0; ) { 31: printf("%d hello world\n", count); 32: count = update(count); 33: } 34: 35: while(1) 36: continue; 37: }

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 4

Basic Use

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 4

Basic Use

Friday, 9 August 13

Initialise the MDB environment using: device to indicate the target device hardware to indicate the debugger (Simulator/ICE

etc) program to load a built executable

Control the program with: run to execute the loaded program halt to stop execution

Print text to the console via stdio functions

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 4

Basic Use

Friday, 9 August 13

Set breakpoints using break Print the content of variables using print Continue execution after stopping using continue

Use step or next to single step Examine memory using the x command

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 5

Advanced Use

Friday, 9 August 13

Set breakpoints using break Print the content of variables using print Continue execution after stopping using continue

Use step or next to single step Examine memory using the x command

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 5

Advanced Use

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 6

Automating Tasks

Friday, 9 August 13

MDB commands can be scripted in a file and automatically executed

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 6

Automating Tasks

Friday, 9 August 13

MDB commands can be scripted in a file and automatically executed

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 6

Automating Tasks

device pic18f87j11hwtool realiceprogram product_15_B.elfbreak i2c.c:32run

product_15_B.txt:

Friday, 9 August 13

MDB commands can be scripted in a file and automatically executed

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 6

Automating Tasks

Friday, 9 August 13

MDB commands can be scripted in a file and automatically executed

Special commands synchronise the debugger and MDB script reader

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 6

Automating Tasks

Friday, 9 August 13

MDB commands can be scripted in a file and automatically executed

Special commands synchronise the debugger and MDB script reader

MDB invocation itself can be part of a script

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 6

Automating Tasks

Friday, 9 August 13

MDB commands can be scripted in a file and automatically executed

Special commands synchronise the debugger and MDB script reader

MDB invocation itself can be part of a script Stimulus SCL (Simulator Control Language)

files can be loaded using the stim command

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 6

Automating Tasks

Friday, 9 August 13

MDB commands can be scripted in a file and automatically executed

Special commands synchronise the debugger and MDB script reader

MDB invocation itself can be part of a script Stimulus SCL (Simulator Control Language)

files can be loaded using the stim command The MDB core jar files allow your own MDB

interface to be created

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 6

Automating Tasks

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 7

Conclusion

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 7

Conclusion

The MDB command-line interface is fast

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 7

Conclusion

The MDB command-line interface is fast Especially suited to automated testing

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 7

Conclusion

The MDB command-line interface is fast Especially suited to automated testing

MDB can use command files and be called from a script

Friday, 9 August 13

© 2013 Microchip Technology Incorporated. All Rights Reserved. MDB: The Microchip Command-line Debugger Slide 7

Conclusion

The MDB command-line interface is fast Especially suited to automated testing

MDB can use command files and be called from a script

Consult the Microchip Debugger (MDB) User’s Guide for full information

Friday, 9 August 13