In this paper, we present algorithms that compute two kinds of information that can help AspectJ developers diagnose and fix potential problems with their pointcuts. First, we present an algorithm to compute almost matched joinpoints. Second, we present algorithms to compute explanations of why a pointcut does not match (or does match) a specific joinpoint. We implemented two tools using these algorithms. The first is an offline tool that analyzes a code base and produces a comprehensive report about the pointcuts in the code. Using this tool, we were able to find several real problems in existing, medium-sized AspectJ code bases. The second tool is an Eclipse plug-in called PointcutDoctor. PointcutDoctor is a natural extension of AJDT that provides developers easy access to the same information from within their already familiar development environment.