Skip to content

Commit 31f9dc4

Browse files
author
Your Name
committed
Support macros from within breakpoints
1 parent 4b4fb36 commit 31f9dc4

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frida-cshell",
3-
"version": "1.5.2",
3+
"version": "1.5.3",
44
"description": "Frida's CShell",
55
"scripts": {
66
"prepare": "npm run build && npm run version && npm run package && npm run copy",

src/cmdlets/misc/macro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ m name ${CmdLet.DELETE_CHAR} - delete a macro
106106
return Var.ZERO;
107107
}
108108

109-
public static run(macro: Macro): Var {
109+
public static runSync(macro: Macro): Var {
110110
let ret = Var.ZERO;
111111
for (const command of macro.commands) {
112112
if (command.length === 0) continue;

src/commands/command.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,24 @@ export class Command {
1717

1818
const macro = this.getMacro(tokens);
1919
if (macro !== null) {
20-
return MacroCmdLet.run(macro);
20+
return MacroCmdLet.runSync(macro);
2121
}
2222

2323
return this.runFunction(tokens);
2424
}
2525

2626
public static runSync(tokens: Token[]): Var {
2727
const cmdlet = this.getCmdlet(tokens);
28-
if (cmdlet === null) {
29-
return this.runFunction(tokens);
30-
} else {
28+
if (cmdlet !== null) {
3129
return cmdlet.runSync(tokens.slice(1));
3230
}
31+
32+
const macro = this.getMacro(tokens);
33+
if (macro !== null) {
34+
return MacroCmdLet.runSync(macro);
35+
}
36+
37+
return this.runFunction(tokens);
3338
}
3439

3540
private static getCmdlet(tokens: Token[]): CmdLet | null {
@@ -45,7 +50,8 @@ export class Command {
4550
if (!name.startsWith(Command.MACRO_PREFIX)) return null;
4651
if (name.length === 1) throw new Error('macro name not supplied');
4752
const macro = Macros.get(name.slice(1));
48-
if (macro === null) throw new Error(`failed to recognozie macro ${Output.green(name)}`);
53+
if (macro === null)
54+
throw new Error(`failed to recognozie macro ${Output.green(name)}`);
4955
return macro;
5056
}
5157

0 commit comments

Comments
 (0)