0

I'm using CocoaLumberjack (https://github.com/CocoaLumberjack/CocoaLumberjack) in my application.

It has a couple of different log macros that I use for example:
DDLogInfo
DDLogVerbose
DDLogWarn
DDLogError

These are defined as macros. I want to create a symbolic breakpoint that will break on all DDLogError. How do I do that?

2
  • Simple: You set a breakpoint on every instance of DDLogError in your code. Or else replace the macro (perhaps temporarily) with a call. Commented Feb 11, 2015 at 12:46
  • 1
    (This is standard C macro stuff which you should know before starting into Objective-C.) Commented Feb 11, 2015 at 12:47

2 Answers 2

2

In short, you don't. Macros are precompiler directives. By the time your program is compiled and running, macros are gone.

Symbolic breakpoints break on specific instance methods and function calls.

The best you might be able to do is to create a dummy method and edit the definition of your DDLogError macro to call that method. Then you could set a breakpoint (symbolic or actual) on that method.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I guess I'm out of luck on that one right now then. Unless I do as you suggested.
1

lldb has a "source regular expression breakpoint" that might help out with this. It will search the text of your source files for some pattern and if the pattern matches set a breakpoint on that source line. You say:

(lldb) break set -p "DDLog"

It isn't as convenient for you maybe, because with no arguments it just looks in the current source file, and you can specify any number of files like:

(lldb) break set -p "DDLog" -f foo.c -f bar.c

but there's no way currently to say "all source files" so you might get tired typing all your files in. But if you only need to set these macro breakpoint in a few files, this might come in handy.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.