简体   繁体   English

Eclipse中的搜索结果断点

[英]Breakpoint on search results in Eclipse

I want to debug my program by putting a breakpoint on the search results. 我想通过在搜索结果上放置一个断点来调试我的程序。

As I have ~1000 matches I am hoping that there is a simple and fast way to do this. 因为我有~1000场比赛,所以我希望有一种简单快捷的方法。

What you can do is generate the Eclipse xml file containing all the breakpoints you need. 您可以做的是生成包含所需断点的Eclipse xml文件。

just right click on the break points tab and choose Expoert Breakpoints... 右键单击Expoert Breakpoints...选项卡,然后选择Expoert Breakpoints...

save the file, edit it programmatically, and import it back. 保存文件,以编程方式编辑,然后将其导入。

A Simple example for writing such file: 编写此类文件的简单示例:

    Map<String, Integer> breakPointsLocation = new HashMap<>();
    // some logic to fill this hashmap based on your search results (you can use grep)

    // header
    System.out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    System.out.println("<breakpoints>");
    for (Entry<String, Integer> entry: breakPointsLocation.entrySet())
    {
        System.out.println("<breakpoint enabled=\"true\" persistant=\"true\" registered=\"true\">");
        System.out.println("<resource path=\"" + entry.getKey() + "\" type=\"1\"/>");
        System.out.println("<marker charStart=\"1317\" lineNumber=\"" + entry.getValue() + "\" type=\"org.eclipse.jdt.debug.javaLineBreakpointMarker\">");
        System.out.println("<attrib name=\"charStart\" value=\"1317\"/>");
        // add some more attrbiutes here
        System.out.println("</marker>");
        System.out.println("</breakpoint>");
    } 

    //footer
    System.out.println("</breakpoints>");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM