Closed HenryRiley0 closed 2 months ago
so the issue is that the variable rename is returned including the "static" modifier, right? What about other modifiers?
concerning the regex: instead of including a space, it seems more reasonable to add a non-matching optional group with the possible modifiers, so currently (static )?
up front instead of adding the space. [that's optional, but not "non-matching", but should be able to tweaked more after verified it works instead of the space-adding)
i tested 'register、const、mutable、volatile、static', only static variable will return a modifier. it seems only static variable will has a modifier,for emphasize the variable's life time is different from loacal vairable. like below:
18-stack-list-variables --thread 1 --frame 0 --simple-values GDB -> App: {"token":18,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["variables",[[["name","regVar"],["type","int"],["value","10"]],[["name","p1"],["type","People"]],[["name","constVar"],["type","const int"],["value","20"]],[["name","volatileVar"],["type","volatile int"],["value","30"]],[["name","testObj"],["type","Test"]]]]]}} 19-data-evaluate-expression "p1" GDB -> App: {"token":19,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["value","{static borth = 10}"]]}} 20-data-evaluate-expression "testObj" GDB -> App: {"token":20,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["value","{mutableVar = 1}"]]}}
static variable and 'anonymous union' variable name has a space. if dont have a space "static borth = 10" and "anonymous union" will test fail.
gdb_expansion.ts
const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-]*|\[\d+\])\s*=\s*/;
parseResult = (pushToStack: boolean = false) => {
value = value.trim();
const variableMatch = resultRegex.exec(value);
if (!variableMatch)
return undefined;
value = value.substring(variableMatch[0].length).trim();
what about something like:
const resultRegex = /\s*(static )?([a-zA-Z_\-][a-zA-Z0-9_\-]*|\[\d+\])\s*=\s*/;
parseResult = (pushToStack: boolean = false) => {
const variableMatch = resultRegex.exec(value);
if (!variableMatch)
return undefined;
value = variableMatch[1];
although from the output presented, we can drop the leading \s*
and replace the others by a single space.
what about something like:
const resultRegex = /\s*(static )?([a-zA-Z_\-][a-zA-Z0-9_\-]*|\[\d+\])\s*=\s*/; parseResult = (pushToStack: boolean = false) => { const variableMatch = resultRegex.exec(value); if (!variableMatch) return undefined; value = variableMatch[1];
although from the output presented, we can drop the leading
\s*
and replace the others by a single space.
thanks for you adivce, modified resultRegex, works fine.
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 19.88%. Comparing base (
1b9f13e
) to head (6f48d86
). Report is 8 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Nice simple one in the end! We should add some automated testing for that, but I am currently not sure how that works -so I've merged it. If you can add tests, please do so.
Nice simple one in the end! We should add some automated testing for that, but I am currently not sure how that works -so I've merged it. If you can add tests, please do so.
ok, i will add static tests
the static member of Class People does not show Log
does not show:
fixed: