julian-weinert / LinkedLog

LinkedLog is a Xcode plugin that includes a Xcode PCH header file template that adds the macros `LLog` and `LLogF` and parses their output to link from the console to the corresponding file and line.
MIT License
22 stars 2 forks source link

Doesn't work, neither Xcode 6.4 nor Xcode 7 beta 3 (7a152u) #8

Open MarcVienna opened 9 years ago

MarcVienna commented 9 years ago

Title says it all - doesn't work. How can you debug it? Enable LinkedLog in Xcode 6.4, disable in 7ß3, build in 7ß3 and Run/Debug. Launch Xcode 6.4, attach that in 7ß3, then debug a simple hello-world project with LLog statements in 6.4. LinkedLog in 6.4 will execute and parse the debugstring, and Xcode 7ß3 will break at breakpoints. Right?

julian-weinert commented 9 years ago

Breakpoints? Multiple Xcode versions? Can you please explain "Does not work"? This issue has a huge variety from doing nothing over hanging and crashing Xcode to causing a kernel panic. What does this mean?

I don't understand why you are using two versions of Xcode. Also you seem to expect breakpoints. Or are you talking about improving / debugging LinkedLog itself?

MarcVienna commented 9 years ago

I have Alcatraz installed and ~10 extensions, half of them work always, the other half only sometimes or not at all. LinkedLog is in the last group - "doesn't work" means that I never saw even 1 blue underscored link. Neither in Xcode 6.4 nor in 7ß3. The debug log was as it always was. No crashes or hanging...

And yes, the two-versions thing was about debugging LinkedLog itself, setting breakpoints in LL source, examining values. That could only work if LL is called from e.g. Xcode 6.4 debugging hello-world with LL enabled, and that Xcode 6 being debugged (attached) by Xcode 7ß3 editing LL source without LL enabled - right?

julian-weinert commented 9 years ago

Yeah, right. That you are not seeing anything is really strange. There is still a bug that causes a crash in some circumstances. But it should always output a link.

Dumb question: did you use LLog() instead of NSLog()?

julian-weinert commented 9 years ago

Oh, by the way, the best approach is to run (build) the project with an official non-beta Xcode.

To do so, simply edit your Run scheme and set your Xcode as the executable. You can select the same Xcode you are already running.

Then quit all Xcode and delete the Plugin from ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/ and restart Xcode.

Nur run the Plugin. This will build the Plugin to the path above. Then, Xcode will launch a new instance of itself (formerly of the application you set as the executable for the Run scheme) attach to it and start a debugging session.

MarcVienna commented 8 years ago

I tried your suggestion: set Xcode6E35b.app as target, quit Xcode, delete the plugin, launch Xcode6E35B again with the LinkedLog project, set a breakpoint in NSTextStorage+findInFiles.m in method _processEditing, line 50 (after the "matches" array is computed). Clicked on Debug. A second instance of Xcode launched, asked to load the LinkedLog.bundle (of course), then I opened my own project and tried to debug... Soon the breakpoint in Xcode1 was triggered. Many times, even though consoleText was empty. After a while, Xcode2 produced console output and Xcode1 tried to find a match with [regExp matchesInString:consoleText...]

However, the array was always empty. The regex never matched. In consoleText, there were lines such as:

2015-10-28 17:02:29.834 vr.de[29651:2929459] COPOSTService.m:109 -[COPOSTService callServiceWithURL:andRequestData:identifiedBy:error:] Calling service

where I would expect "COPOSTService.m:109" to be found. Your newest sample added a second colon after the line number, which I tried also:

2015-10-28 17:02:29.900 vr.de[29651:2929459] BATitleView.m:210: -[BATitleView loadB] Logon

where I would expect "BATitleView.m:210:" to be found. But the array "matches" is always empty... Should work, yes?

OK, then let's examine the regex: NSString pattern = @"^[\d]{4}-[\d]{2}-[\d]{2}\s[\d]{2}:[\d]{2}:[\d]{2}.[\d]{3}\s[^[][\d:\d]\s(.+\/([^\/:]+:\d+)):\s.*";

Two hours later... I got it... When debugging e.g. Apple sample code such as MoveMe, your plugin works - because the consoleText directly starts with debug output generated by LLogF. I see blue filename:linenumber text. Yeah.

However, my main project includes a security library which generates 9 lines of output like

13: Unix: http_module_mangled_mangled.cpp:50: http_module_init: strings

before any LLogF statements. It seems your regex cannot skip over that, and thus never examines the 10th and following lines where the LLogF statements are...

Since I am no regex guru - do you have a suggestion how to modify the pattern to skip those bad-formatted lines? And yes, more such lines may be later in the consoleText also...

Thanks, Marc

julian-weinert commented 8 years ago

Hey Marc! Sorry for forgetting this... Is this still an issue for you? Otherwise I'd close it