Xcode 4: debugging does not highlight current line in source code - debugging

I just reinstalled Xcode 4 from the App Store, but still the same issue:
When the debugger hits a break point the program stops and shows the stack trace. However, the line in the source code is not highlighted.
I tried clicking on various entries in the stack trace and stepped through the code - no highlighting.
EDIT:
I think I found the reason (but not solution yet): I have organized the source files into sub-directories. Each sub-directory is mapped to a group in Xcode. I bet Xcode checks only the project directory for source files not sub-directories.
My layout:
./Project Dir
Classes/
Group1/
Class.m
Group2/
AnotherClass.m
...
EDIT 2:
I just noticed that the debugger does highlight the line in main.m, but not in any other source file.

You can click on the sign in order to hight the line:
click

Finally found it. Culprit was this line in the source file:
#line __LINE__ "MainController.m"
Turns out that this confuses Xcode and I assume because of that Xcode won't find the file anymore to highlight the current line of a breakpoint.
The purpose of the preprocessor definition was to shorten log statements, which would contain the full path to the file in log statements when using the __FILE__ macro.

Related

Debugging go in vscode doesn't stop at breakpoints, says "Could not find file ..." when debugger starts

Ubuntu. vscode 1.62.1. go1.17.3. vscode go extension v0.29.0. delve v1.7.1.
I'm new to vscode and Go. I have many years of experience debugging Java apps in Eclipse.
I've constructed a small multi-module Go app. I can set a breakpoint in main and other functions in other modules. Inside main.go, I select "Start Debugging".
It starts the application, and I can tell it's working from the console, and that the REST endpoint responds with my dummy response.
However, it will NOT stop at breakpoints. As soon as I start the session, the red breakpoint markers suddenly become hollow, and hovering on one of them shows a message "Could not find file ...", which prints the full path to the source file in question.
When I start it, it shows the following in the console:
Starting: /home/.../go/bin/dlv-dap dap --check-go-version=false --listen=127.0.0.1:43347 --log-dest=3 from /home/.../...
DAP server listening at: 127.0.0.1:43347
I haven't modified the launch.json (I hope someday a friendlier interface to editing launch configurations is provided).
What else could I be doing wrong?
Update:
This is a screenshot showing main.go just before I press F5 (Start Debugging):
Notice that I have a breakpoint on the print statement, on the first line of main.
This is what I see after I press F5:
Notice that it printed "At start of main" in the console. It didn't stop at the breakpoint. Also notice message in tooltip when hovering over the breakpoint.
Update:
This is a view of my directory structure:
First, just make sure you have initiated your project with go mod init voltagems: that would explain the import "voltagems/xxx", but also helps delve to find your main.go file at debug time.
You should have go.mod and go.sum files beside main.go.
Second, check your go env output, making sure GOPATH and GOROOT are set to default paths.
The OP David M. Karr adds in the comments:
I did run "go mod init" when I first created the project, but I realized that I didn't like the root module name, so I changed it to "voltagems"
I believe you can edit directly go.mod first line, and make sure it says:
module voltagems
Then go mod verify + go mod tidy
Finally, go build .. Restart your VSCode (or the command Reload Window), and see if the issue persists.
The OP David M. Karr points out to a root cause:
There are symbolic links in my project path.
There is a "substitutePath" configuration in VSCode-Go that is used to map to absolute paths.
You can see this parameter mentioned in Debugging with Legacy Debug Adapter
substitutePath
Path mappings to apply to get from a path in the editor to a path in the compiled program (default: []).
That comes from issue 622 "debug: breakpoints don't work when working with symlink".
And commit 93f32bb
src/debugAdapter: add substitutePath config for debugging
This change adds a new configuration option to both launch and
attach requests.
substituePath takes an array that maps from string to string that is used to translate paths passed to the debugger and then
back to the client.
This allows users to translate their symlinked directories to the
files that were actually used to build the binary.
In addition this can also be used for remote debugging, and when the location of the files has moved since the program was built.
Example: you need a from and to key:
"substitutePath": [
{
"from": "/symlink/path/dir/on/local/machine",
"to": "/absolute/path/dir/on/local/machine",
},

Can't make Dracula theme work on Vim [os: W10]

So, I followed the instuctions in their website, there's a .vim/pack/themes/start path with the dracula folder there with everything and I add the three lines to the _vimrc (had to open as admin to be able to save changes) file in my FilesProgram/Vim folder
after that, two other files appeared, a ._vimrc.un~ and _vimrc~ and now when I try to open vim it gives the following error
Error detected while processing C:\Program Files (x86)\Vim\_vimrc:
line 41:
E919: Directory not found in 'packpath': "pack/*/opt/dracula"
line 43:
E185: Cannot find color scheme 'dracula'
Can anybody tell me where Is the mistake and how to fix it?
We have a cascade of mistakes, here.
The first one was made by the Dracula maintainers, who forgot not everyone uses the same system as them and therefore only provided instructions for "Unix"-like systems and not for Windows (and even those are incorrect anyway).
The second one was made by you, who blindly followed "Unix" instructions on Windows despite the many incompatibilities between those systems.
The third one was also made by you, who edited the system-wide C:\Program Files (x86)\Vim\_vimrc instead of your C:\Users\Edrods\_vimrc.
Follow these steps to fix your setup:
Create C:\Users\Edrods\vimfiles\.
This directory is where all your configuration is supposed to happen. Don't do anything Vim-related anywhere else.
Whenever you see ~/.vim/ mentioned in a tutorial or README.md, replace it mentally with C:\Users\Edrods\vimfiles\.
Create C:\Users\Edrods\vimfiles\vimrc.
This is your main configuration file.
Whenever you see vimrc, .vimrc, or _vimrc mentioned in a tutorial or README.md, replace it mentally with C:\Users\Edrods\vimfiles\vimrc.
Revert any change you may have performed in C:\Program Files (x86)\Vim\.
Whatever line you have added to C:\Program Files (x86)\Vim\_vimrc must be moved to C:\Users\Edrods\vimfiles\vimrc.
Whatever file or directory you may have added to C:\Program Files (x86)\Vim\ must be moved to C:\Users\Edrods\vimfiles\.
The goal is to return C:\Program Files (x86)\Vim\ to its pristine state and forget that directory even exists. It is off-limits.
Put the dracula directory where it belongs:
C:\Users\Edrods\vimfiles\pack\themes\start\dracula
Add these lines to your vimrc (remember what I said earlier about mentally replacing it with the correct path?) if they are not there already:
syntax enable
colorscheme dracula
(Optional) Tell the maintainers of that colorscheme to fix their installation instructions.

Adding a user-defined language in Notepad++

I'm trying to add the syntax plugin for the Go programming language in Notepad++.
There is a repository for such user-defined languages. I downloaded and unzipped the Go files, which contained a README, a userDefinedLang_Go.xml, and go.xml.
I attempted to follow the instructions at the bottom of the page as follows. Since I am using Windows 7 (x64), my Notepad++ directory is "C:\Program Files (x86)\Notepad++".
Having not installed a user defined language before, I didn't have a userDefinedLang.xml file already, so I copied userDefinedLang_Go.xml into the root directory, and renamed it to remove the "_Go", making it userDefinedLang.xml.
I then copied go.xml into C:\Program Files (x86)\Notepad++\plugins\APIs\
This seems to be all of the steps necessary. However, when I open Notepad++, there is no "Go" near "Lang => User Defined", and there is no syntactic coloring on a .go file. Attempting to import via "View => User-Defined Dialogue => import" gives a "fail to import" error.
What am I doing wrong? I'm using a clean installation of Notepad++, which is version 6.1.8.
I had to put my userDefineLang.xml file in my AppData\Roaming folder:
C:\Users\[user]\AppData\Roaming\Notepad++
New install of Notepad++ 6.4.5 on Windows 7 64 bit
Download from Notepad++ site:
http://docs.notepad-plus-plus.org/index.php?title=User_Defined_Language_Files#G
Copy "go.xml" to C:\Program Files (x86)\Notepad++\plugins\APIs.
The default install doesn't have any user-defined languages, so you can do this:
Copy "userDefineLang_Go.xml" to C:\Users\\AppData\Roaming\Notepad++
Remove the "_Go" from the file name, so it's "userDefineLang.xml"
Uncomment the opening and closing "NotepadPlus" tags.
(If you already have a userDefineLang.xml then add the content from the _Go file.)
Restart Notepad++.
I just got it working on my system after some tinkering. Put this at the top of the userDefinedLang.xml file and the go.xml file:
<?xml version="1.0" encoding="Windows-1252" ?>
That should do the trick (after reopening Notepad++).
go.xml should be in the plugins/APIs folder, and userDefinedLang.xml goes in the root of Notepad++ as you said.
Something other answers do not discuss: Some older versions of Notepad++ do not appear to work with any of these answers.
I tried pretty much all the solutions before upgrading Notepad++ to version 6.4.2.
xkcd 979
Tested Notepad++ versions:
5.9 - not working - tested by namey
6.4.2 - working - tested by Elysian Fields
6.6.9 - working - tested by namey
For other versions your mileage may vary.
I share the solution I found for Notepad++ 6.5, because I had the same issue than the previous messages.
If not done, do the install steps explained in go\misc\notepadplus\README (userDefineLang.xml,functionList.xml,APIs).
When you don 't have useDefineLang.xml in Notepad++, create one using the file from go\misc\notepadplus\useDefineLang.xml, but don't forget to add the first line <?xml version="1.0" encoding="Windows-1252" ?>
and uncomment NotepadPlus part to have <NotepadPlus> at the beginning and </NotepadPlus> at the end.
Change in functionList.xml: <association ext=".go" id="go"/> BY <association userDefinedLangName="go" id="go"/>
As I didn't have any userDefineLang.xml file by default in Notepad++, I imported this file using the menu Language → Define your language → *Import.
Then stop/start Notepad++.
Check that Go is in the Language menu at the end of the list.
Open a .go file. If the color doesn't change automatically click on go in /Language menu
All were OK after that for me (indentation, color, autocompletion, etc.).
I added pl/sql language syntax to Notepad++. The syntax /language was on the web. Here's how I got it to work ...
Open the XML file using Notepad and added <?xml version="1.0" encoding="Windows-1252" ?> to the very beginning, as David had suggested. Then save it to userDefinedLang_plsql.xml
Paste the file in the Notepad++ root directory.
I also copied it into C:\Program Files (x86)\Notepad++\plugins\APIs\, and navigated to menu Languages → Userdefined, but it did nothing.
So, I then went to menu Languages → Define your language and selected pl/sql from the drop down, renamed it, and saved it in that dialog window.
The new language then it appeared in the language dialog at the end.
userDefineLang resides in C:\Users\username\AppData\Roaming\Notepad++\userDefineLang.xml.
Make sure your Notepad++ is installed under "C:\Program Files(86)", and not under "C:\npp.#.#.#.bin" folder.
And download from https://notepad-plus-plus.org/download. Or simply google "Download Notepad++".
Check out a sample Scala language userDefineLang.xml file here: https://github.com/nfang/scala-syntax-highlighter
If you don't have any user languages defined before, then after renaming userDefinedLang_Go.xml to userDefinedLang.xml, also edit the text of file by adding the tags <NotepadPlus></NotepadPlus> around the original content.

appledoc Exception: at least one directory

After wasting some time to figure out what goes wrong, I finally have to ask for help. I want to use appledocs from Gentle Bytes. I followed every step of the quick install guide, but I´m not able to compile the project.
Here is what I´ve done:
1. cloned it from git://github.com/tomaz/appledoc.git
2. installed the templates to ~/Library/Application Support/appledoc
3. tried to compile the project
Everytime I try to compile, I get following error:
ERROR: AppledocException: At least one directory or file name path is required, use 'appledoc --help'
What do I have to do now?
Sounds like you've compiled it just fine and are now running the program. If it's a command-line program try command-option-R in Xcode to provide some arguments (i.e. names of files that you want to process).
The error means you didn't give it source paths: after all switches, you must give it at least one path to your source files. Can be either file or directory. In later case it will recursively scan the dir. Here's example
appledoc <options> ~/MyProject
Above example will use ~/MyProject directory as a source. You can also add multiple source paths. Note that you need to give the tool few options, see this page for minimum command line and other usage examples.
You either have to copy appledoc executable to one of directories in your path, as suggested by Caleb, or use full path to it when invoking (for example: /path/to/appledoc)

How do I enable syntax highlighting for my Gemfile in Sublime Text 2?

I recently started using Sublime Text 2. What an awesome editor. It does a great job of highlighting Ruby code, but it does not highlight my Gemfile.
Is there a way to get it to do that?
I found this Gist but it has no instructions on how to use it.
There are at least three options:
Switch syntax manually (not preferred, but easy; no explanation required)
Add "Gemfile" to the list of Ruby-syntax files
Use the plugin you link to and create a package for it
1. No explanation, but handy trick
You can bind a keystroke to set syntax without moving to the mouse.
I bound syntax changing to Ctrl-Opt-Space by adding the following to my user keybindings:
[
{ "keys": ["ctrl+alt+space"],
"command": "show_overlay",
"args": { "overlay": "command_palette", "text": "Set Syntax: " } }
]
2. Add "Gemfile" to list of Ruby-syntax files
Linux: ~/.config/sublime-text-2/Packages/Ruby/Ruby.tmLanguage
OS X: ~/Library/Application Support/Sublime Text 2/Packages/Ruby/Ruby.tmLanguage
Windows: %APPDATA%/Sublime Text 2/Packages/Ruby/Ruby.tmLanguage
You can also get there by using the menu option Preferences -> Browse Packages and going into the Ruby package. Once you're in the file it'll be obvious: it's the <array> element with Ruby-looking filenames. Add <string>Gemfile</string> and you're all set.
It's possible the setting could get overwritten on an upgrade; I'm not sure how that works with ST2–it may be cleaner to do it through code as in the snippet.
3. Using the snippet you linked to
More work (and the correction of one syntax error). You can either do it manually, by creating a directory in Packages (see above for location) or create an actual package and allow ST2 to install it.
I created a test package called "Syntax" and copied the snippet into it, restarted ST2, and opening a Gemfile worked as expected. The correction required an additional colon (new gist), nutshell:
elif name[-3] == "erb": # Needed a semi-colon here.
set_sintax(view, "HTML (Rails)", "Rails")
If you are here but are using Sublime Text 3 you might not be able able to find the 'list of Ruby-syntax files' in packages.
Most other solutions found online were confusing to me.
I fixed this by manually changing Gemfile to Ruby in the bottom right hand corner file extension menu item when you have opened the file in Sublime Text 3 (which is what I had been doing each time I opened the file up until now).
Once you have selected ruby then go to Preferences -> Settings-More -> Syntax Specific-User
{
"extensions":
[
"Gemfile",
"Gemfile.lock"
]
}
When you navigate to Syntax Specific User it opens a file specific to the language that the file has syntax highlighting for. You may need to change the file back to whatever it is defaulting too (mine was 'Rd (R Documentation).sublime-settings') and removing Gemfile from that Syntax highlighting file.
In Ubuntu these files are stored at
~/.config/sublime-text-3/Packages/User
The DetectSyntax plugin for ST2 provides a more comprehensive solution to highlighting files - It allows file highlighting based on rules. It's smart enough to understand the difference between a Rails file, other files that use .rb as an extension and standard ruby files.
The standard rules include Gemfile, Rakefile, Guardfile and others matched to Ruby for Syntax formatting.
See DetectSyntax on GitHub.
You can achieve this by copying the HTML.tmLanguage file in the User/ folder, this way it won't be overwritten by an update.

Resources