Change LLVM Xray instructions during runtime - clang

Is it possible to change the "always instrument" to "never instrument" while running a program? By that, I mean, is it possible to change attributes and expect Xray to run without recompiling the program?

The LLVM guide says it is possible to change the status of instrumentations using the xray_instr_map, but I'm not sure how to use it.

Related

Restricting a Bazel target to specific platforms

I have a target which can only be built for Linux (in this case, because it depends on syscalls only available on Linux and there is no desire to try and make this cross-platform). How can I express this in my BUILD files?
I can see from the Platforms documentation that there exists a Linux platform definition as #bazel_tools//platforms:linux, but it is not clear to me how to make use of this to restrict a target. Trying to specify this in compatible_with results in an error like this:
(13:27:09) ERROR: /foo/BUILD:4:1: in compatible_with attribute of go_library rule //foo:go_default_library: constraint_value rule '#bazel_tools//platforms:linux' is misplaced here (expected environment). Since this rule was created by the macro 'go_library_macro', the error might have been caused by the macro implementation in /foo/BUILD:4:1
So I have a few related questions:
The error seems to indicate I've supplied the wrong type of rule to compatible_with. What is an environment and how do I provide one? (I've struggled to find documentation on this)
I gather that the migration to Platforms might not yet be complete and rules_go might not have been updated. If it's not possible with Platforms, is there an "old way" to do this instead?
Ideally, I would like this not to result in build errors when running commands like bazel test //:all on a different (non-Linux) platform – ie. I'd prefer it just exclude these, or something. Is this possible?
Thanks for your help 😊
Turns out that this is an open issue. Once this is fixed, I think it should be possible: https://github.com/bazelbuild/bazel/issues/3780

Set Hindi as locale in VSCode

I'm unable to set hindi as a locale in VSCode.
I know that it is added in the list of community driven languages as suggested in
https://github.com/Microsoft/Localization/wiki/Visual-Studio-Code-Community-Localization-Project
However, I can't understand how to include and use it in VSCode.
Kindly help with the steps required to add the same.
Btw, there is no hindi language pack available in the marketplace,is there some other way to get it?
As far as it stands there is no other way to get it other than marketplace unless the following is published as stated here on point no. 5:
After translation coverage reach 50% and below files are fully localized, we will publish language pack of this language in Marketplace. We encourage community members to publish language pack by yourself.

Using Vim instead of (or with) Xcode for iOS development

Xcode comes with a lot of things that are essential to building to the iPhone and/or iPad. In fact a lot of it I am not even aware of because it is so 'behind the scenes'.
On the other hand, I have recently been exposed to the advantages of using Vim as an editor. Is there any setup which would make using Vim an efficient option when developing for the iOS platforms? Or would it be so complicated to combine the two as to make this question moot?
In other words, if you have any tips, advice or warnings when using Vim and Xcode together, I am all ears!
Developing for iOS or Mac with Vim can be really powerful and fast, especially if you use TDD or want quick feedback.
But it takes a bit of finagling to get it working. The few important things you need to know are:
Use the xcodebuild command-line tool to run your build and units from some vimscript.
Use the clang_complete plugin to give you full code completion from within vim.
Use the ios.vim and cocoa.vim plugins for navigation.
This is my preferred method of working. In fact, I wrote the ios.vim plugin to make this easier for more people.
I've been there already...
I love vim and regularly use it in my day-by-day C++ development on *nix platforms, but I also like all of Xcode's features which, specially with latest Xcode >= 4.3 and clang backend, give a real plus in terms of auto-completion and symbol referencing.
I think I've found the optimal solution with the great (although not officially supported by Apple) XVim plugin.
Hoping that future Xcode upgrades won't break it (it's still working fine with latest developers' previews of 4.5), this really allows you to keep your fingers moving as you've learned doing in Vim while working with Xcode, which as I said, is for me the optimal solution.
Vim and XCode will co-exist quite well together provided that you aren't trying to edit the same files in Vim and the XCode editor at the same time. If you do then each will give you a warning about the file being modified externally. The terminal version of Vim is a little easier to live with in this particular respect: it will only warn you when you try to save the file, asking are you sure, whereas MacVim, and the XCode editor, will warn you each time you return to the file.
XCode does allow you to select an external application when you open files, by file type. In XCode Preferences, go to the File Types tab, and then file->text->sourcecode. Preferred Editor can be set to an external program such as MacVim; note that Emacs should be already listed as a selection: when Emacs is selected XCode launches Terminal.app with Emacs in a terminal. This Preferred Editor setting has the problem that you'll get a new window with each opened file, which may not match your workflow.
Vim's remote feature might prove useful here, see :help remote. With a little work, and the above Preferred Editor preference, one should be able to send the file to be edited to any instance of Vim, including an existing Vim running within an xterm. I seem to recall that Emacs provides something similar.
But none of this precludes you from using Vim without setting Preferred Editor: just open and edit your project files in Vim as you would normally.
Your workflow might be to use Vim for editing code, and switch to XCode for building the project, but Vim can also run the same build tools that XCode uses, and with a little more work you'll even be able to jump to the lines with errors. XCode relies on gdb for debugging, which can also be used quite well with Vim, via plugin.
Of course Vim can't be expected to replace something like Interface Builder, but just about every other aspect of iOS dev can be achieved with a Vim-only solution.
Or just use Vim to edit your code faster, and continue to use XCode for the rest.
Starting with Xcode 13.0 Beta you can use Vim keybindings in Xcode. It is enabled in settings:
Preferences → Text Editing → Editing → Enable Vim key bindings
Edit (per #fangxing):
The way to toggle what is now called Vim Mode changed:
Menubar → Editor → Vim Mode
Even thought MacVim with YouCompleteMe is my main environment for development on OSX, there are tasks I prefer to do in XCode, like debugging and profiling. For these scenarios I use XVim which adds VIM editing capabilities to XCode.
On XCode 5.1 XVim crashed quite a lot. But it progressed and it now works quite well with XCode 6 so far. But you only get a subset of VIM this way, e.g. you can't split the editor to view two files at the same time. You can enable/disable it quite easy with Shift-Command-X.
(Sorry to post this as answer and not as a comment, but the reputation-system of stackoverflow did not made it possible for me)
I can't recommend YouCompleteMe enough! Beside its code-completion it also shows you syntactic errors on the fly on the affected line without the need of manually triggering your compiler (i.e. very similar to the features of the XCode editor). The description of the YCM creator is quite informative:
YouCompleteMe is a fast, as-you-type, fuzzy-search code completion
engine for Vim. It has several completion engines: an identifier-based
engine that works with every programming language, a semantic,
Clang-based engine that provides native semantic code completion for
C/C++/Objective-C/Objective-C++ (from now on referred to as "the
C-family languages")...
To get it running:
Follow the section 'Mac OS X super-quick installation'
Don't forget to add a .ycm_extra_conf.py file to the root of your project folder
Edit:
Without a plugin like YouCompleteMe, VIM can only do rudimentary word completion (Ctrl-N) which is neither aware of the programming language you're using nor of all the other files belonging to your project. You also don't get a list of the members of an object after you type '.' or '->'. So you miss on a lot of help (and therefore speed) XCode is giving you while typing. Also VIM doesn't warn you like XCode when you make typos or other errors in your code. YouCompleteMe adds exactly those missing features to VIM and makes iOS development in VIM a joy.
You could use xcodebuild to build and run your project, but personally I prefer to work with VIM and XCode at the same time. Both reload documents automatically after they have been modified by the other. Keep XCode for debugging, profiling and deployment.
Using AppCode in parallel with Xcode is just amazing. Code changes sync right away! I am so happy with this setup because I can finally use vim (as an AppCode plugin) when writing iOS apps. AppCode has additional advantages so I really recommend that you check it out. The refactoring tools are also way better IMHO. E.g. it can extract methods that Xcode can't for some reason and if it can not extract a method it will at least tell you why.
There are definitely some advantages using external editors ( however emacs is ten million times better than vim:}).
Stick with Xcode for most stuff, but when you need the power of emacs, or possibly vim ( bulk repetitive editor macros is my main reason), just edit the file using show in finder and open with, or just by switching to your editor navigating to the file from there.
XCode will realise when you switch back that the file has changed.
For plain code, I'd stick with Xcode, it's code completion is based on more knowledge of the code, so beat's emacs or vim's hands down. Continuous code checking is invaluable, and as already mentioned, the direct access to the documentation is awesome ( option click if you haven't already found it).
I like XVim for XCode. Unfortunately, it breaks for XCode 5.1 (some people got Development branch working, but I couldn't).
I ended up switching to AppCode after a trial, I really liked the tab management, refactoring, and code analysis. Code is automatically synced with XCode, so I run both (XCode for build settings, managing asset catalog. AppCode for everything else).
First day I downloaded it, I installed IdeaVim so I could still use some of the Vim keyboard shortcuts.
Though you won't get to full Vi/Vim functionality with the plugin. I find mix usage with native IDE commands is enough to compensate.
According to my opinion Xcode is better solution. It has so many features that you can not find/add in Vim. Some of them are:
Interface Builder (to create good lookin interfaces in less time)
ARC (Automatic Reference Counting—memory management)
Automated process for managing code signing and app store submission
The list is very long and Apple always encourages you to use Xcode, not any other IDE.

How to change the language displayed in the report of FindBugs

I am using FindBugs to generate a report for my application by using Ant target. In the report, it is mixed with french and english. Does anybody know to generate a report only with english?
Thanks in advance!
Ikeforward
If you use the downloaded version of findbugs, you can just invoke it with
LANG="C" ./findbugs
Or however you start it, the LANG="C" has to be in the environment. This should work on most (all?) operating systems. There is some documentation about the i18n environment variables at the Open Group. An example how to do this with Ant is available here:
http://findbugs.sourceforge.net/manual/datamining.html#antexample
(asking Google for "ant findbugs language" had this at it's first result, I hope it works)
According to http://findbugs.sourceforge.net/manual/running.html
I think that you should use the following
-Duser.language=en
to have the whole thing in English.
Waldheinz's answer may work for you. The more general answer is that you probably need to change the locale that FindBugs is running in. The way to do this depends on how you're running it (command line, or from eclipse, or from ant...) and what operating system you're using. This page may provide you with the rest of the info you need - but probably not. If not, provide specifics.

actionscript - testing actionscript via command line

I would like to know if is there any easy way to test actionscript by using some kind of application like ruby's irb or javasctip spidermonkey where you can just open up your terminal and type the code straight away.
This would be a good time saver when speaking of actionscript, since to test some syntaxes, classes, etc. you would need to compile it via fsch.
But still not a good option just for quick testing, etc...
Duplicate Answer By Duplicate User
Please Flag User:
Gama11
I have used FlashDevelop in some of my projects where automated builds were necessary: FlashDevelop has always utilized .Net and haXe an open source complier for AS 2.0 and later AS 3.0 ...
Flash Develop will utilize haXe in a command line fashion: within the project settings you are able to modify this command set or deploy manually once the windows based platform has been installed.
Sometimes I use NotePad++ to write down and save parts of my code so I can see it clearly. It does contain Actionscript in the "Languages", and it is plain and easy to use. But I am not sure how much it checks for mistakes.
I believe that writing and compiling in flash is the easiest way. If you have a syntax error it will tell you.

Resources