MCPcopy Create free account
hub / github.com/Marus/cortex-debug / setFunctionBreakPointsRequest

Method setFunctionBreakPointsRequest

src/gdb.ts:1920–1991  ·  view source on GitHub ↗
(
        r: DebugProtocol.SetFunctionBreakpointsResponse,
        a: DebugProtocol.SetFunctionBreakpointsArguments)

Source from the content-addressed store, hash-verified

1918 DebugProtocol.SetInstructionBreakpointsArguments |
1919 DebugProtocol.SetDataBreakpointsArguments>();
1920 protected setFunctionBreakPointsRequest(
1921 r: DebugProtocol.SetFunctionBreakpointsResponse,
1922 a: DebugProtocol.SetFunctionBreakpointsArguments): Promise<void> {
1923 const doit = (
1924 response: DebugProtocol.SetFunctionBreakpointsResponse,
1925 args: DebugProtocol.SetFunctionBreakpointsArguments,
1926 pendContinue: PendingContinue): Promise<void> => {
1927 return new Promise(async (resolve) => {
1928 const createBreakpoints = async () => {
1929 try {
1930 await this.miDebugger.removeBreakpoints(this.functionBreakpoints);
1931 this.functionBreakpoints = [];
1932
1933 const all = new Array<Promise<OurSourceBreakpoint | MIError>>();
1934 args.breakpoints.forEach((brk) => {
1935 const arg: OurSourceBreakpoint = {
1936 ...brk,
1937 raw: brk.name,
1938 file: undefined,
1939 line: undefined
1940 };
1941 all.push(this.miDebugger.addBreakPoint(arg).catch((err: MIError) => err));
1942 });
1943
1944 const breakpoints = await Promise.all(all);
1945 const finalBrks: DebugProtocol.Breakpoint[] = breakpoints.map(
1946 (brkp) => {
1947 if (brkp instanceof MIError) {
1948 /* Failed breakpoints should be reported with
1949 * verified: false, so they can be greyed out
1950 * in the UI.
1951 */
1952 return {
1953 verified: false,
1954 message: brkp.message
1955 };
1956 }
1957
1958 this.functionBreakpoints.push(brkp.number);
1959
1960 return {
1961 source: {
1962 path: brkp.file,
1963 name: brkp.raw
1964 },
1965 line: brkp.line,
1966 instructionReference: brkp.address,
1967 id: brkp.number,
1968 verified: true
1969 } as DebugProtocol.Breakpoint;
1970 }
1971 );
1972
1973 response.body = {
1974 breakpoints: finalBrks
1975 };
1976 this.sendResponse(response);
1977 }

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected