Specifying the number base for watch variables when debugging in VS Code
331reads
Synopsis
The text describes debugging watch features. Format: variable, base where o=octal, b=binary, h/x=hexadecimal, other digits=n-ary. Segment watch: Use *pointer@length to monitor arrays, e.g., *param.data@10 watches 10 uint8t values; combine with format like *param.data@10,h. Casting works: `*(uint16t*)param.data@10,h`. Segment selection: Alt+Shift+drag (poor); better: hold mouse wheel and drag.
Specifying the number base for watch variables when debugging in VS Code
variable, basewhere o=octal, b=binary, h/x=hexadecimal, other digits=n-ary. Segment watch: Use*pointer@lengthto monitor arrays, e.g.,*param.data@10watches 10 uint8t values; combine with format like*param.data@10,h. Casting works: `*(uint16t*)param.data@10,h`. Segment selection: Alt+Shift+drag (poor); better: hold mouse wheel and drag.Format
variable,baseFor example,
ucCRCHi,hwatchesucCRCHiin hexadecimal.Range watch
For example,
param.datais a pointer of typeuint8_t *. Once it is passed into a handler function, the watch cannot correctly determine the length of the array, so only the first value can be watched.Using
*param.data@10lets you watch 10 values of typeuint8_t *starting atparam.data.You can also combine it with the watch format:
*param.data@10,hwatches in hexadecimal.Going further, you can use a cast such as
*(uint16_t*)param.data@10,hto watch 10 16-bit values starting at the addressparam.data.Box selection
Alt+Shift+drag with the mouse performs a box selection, but it is not very convenient.
What works better is holding down the mouse wheel and dragging.