11import { Token } from '../../io/token.js' ;
22import { Var } from '../../vars/var.js' ;
33import { TypedBpCmdLet } from './bp.js' ;
4- import { Bp , BpType } from '../../breakpoints/bp.js' ;
4+ import { BpType } from '../../breakpoints/bp.js' ;
55import { Bps } from '../../breakpoints/bps.js' ;
66import { BpReplacement } from '../../breakpoints/replace.js' ;
77import { Output } from '../../io/output.js' ;
8+ import { CmdLetBase } from '../../commands/cmdlet.js' ;
89
910export class ReplaceCmdLet extends TypedBpCmdLet {
1011 name = 'replace' ;
1112 bpType = BpType . Replacement ;
12- help = `replace a function with another implementation (returns the address of the trampoline) ` ;
13+ help = `replace a function with another implementation` ;
1314
1415 public runCreate ( tokens : Token [ ] ) : Var | null {
1516 const vars = this . transform ( tokens , [ this . parseVar , this . parseVar ] ) ;
@@ -22,7 +23,7 @@ export class ReplaceCmdLet extends TypedBpCmdLet {
2223 Bps . add ( bp ) ;
2324 bp . enable ( ) ;
2425 Output . writeln ( `Created ${ bp . toString ( ) } ` ) ;
25- return Bp . idToVar ( index ) ;
26+ return Var . fromId ( index ) ;
2627 } catch ( error ) {
2728 throw new Error ( `failed to replace ${ address } with ${ target } , ${ error } ` ) ;
2829 }
@@ -44,6 +45,15 @@ export class ReplaceCmdLet extends TypedBpCmdLet {
4445 return bp . trampoline ;
4546 }
4647
48+ protected override usageShow ( ) : string {
49+ const usage : string = `
50+ ${ this . name } - show all ${ this . bpType } breakpoints
51+
52+ ${ this . name } ${ CmdLetBase . NUM_CHAR } n - show a ${ this . bpType } breakpoint (returns the address of the trampoline)
53+ ${ CmdLetBase . NUM_CHAR } n the number of the breakpoint to show` ;
54+ return usage ;
55+ }
56+
4757 protected override usageCreate ( ) : string {
4858 const usage : string = `
4959replace dest src - replace function
0 commit comments