All files / src/components/GdbComponents/BreakPoints BreakPoints.jsx

84.12% Statements 53/63
71.42% Branches 5/7
50% Functions 1/2
84.12% Lines 53/63

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 641x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x             5x 3x       5x 5x 5x 5x 5x 5x 1x 2x 2x 8x 8x 8x 8x 8x 8x 2x   5x 5x 5x 5x 5x 1x 1x  
import React, { useEffect, useState } from "react";
import { DataState } from "./../../../context/DataContext";
import "./BreakPoints.css";
import axios from "axios";
 
const data = [
  {
    offset: "0x2fffa36f603112ffff34",
    addr: "/Users/shubh/lib/node_modules/@stdlib/math/docs/t.js:18",
  },
  {
    offset: "0x2fffa36f603112ffff34",
    addr: "/Users/shubh/lib/node_modules/@stdlib/math/docs/t.js:18",
  },
  {
    offset: "0x2fffa36f603112ffff34",
    addr: "/Users/shubh/lib/node_modules/@stdlib/math/docs/t.js:18",
  },
  {
    offset: "0x2fffa36f603112ffff34",
    addr: "/Users/shubh/lib/node_modules/@stdlib/math/docs/t.js:18",
  },
];
 
const BreakPoints = () => {
  const { refresh, setInfoBreakpointData, infoBreakpointData } = DataState();
 
  const fetchInfoBreakpoints = async () => {
    const data = await axios.post("http://127.0.0.1:10000/info_breakpoints", {
      name: "program",
    });
    console.log(data.data["result"]);
    setInfoBreakpointData(data.data["result"]);
  };
  useEffect(() => {
    if (refresh) {
      console.log("click from breakpoint in GdbComponents");
      fetchInfoBreakpoints();
    }
  }, [refresh]);
  return (
    <div>
      {/* BreakPoints */}
      <div className="breakpoints">
        {infoBreakpointData
          ? infoBreakpointData
          : data?.length > 0
          ? data.map((obj) => {
              return (
                <div>
                  <div>{obj.offset}</div>
                  <div>{obj.addr}</div>
                </div>
              );
            })
          : infoBreakpointData}
        {}
      </div>
    </div>
  );
};
 
export default BreakPoints;