background preloader

The Penguin!

Facebook Twitter

Assembly - tell gdb to disassemble "unknown" code. Secondary Expansion - GNU `make' 3.8 Secondary Expansion In the previous section we learned that GNU make works in two distinct phases: a read-in phase and a target-update phase (see How make Reads a Makefile).

Secondary Expansion - GNU `make'

GNU make also has the ability to enable a second expansion of the prerequisites (only) for some or all targets defined in the makefile. In order for this second expansion to occur, the special target .SECONDEXPANSION must be defined before the first prerequisite list that makes use of this feature. If that special target is defined then in between the two phases mentioned above, right at the end of the read-in phase, all the prerequisites of the targets defined after the special target are expanded a second time. What is the colon equals sign ( := ) in makefiles? In Linux makefiles, you will often see a notation which looks like this: This is called "expansion assignment".

What is the colon equals sign ( := ) in makefiles?

So what is the difference between expansion assignment and ordinary variable assignment ( = )? Let's get straight into a coding example: Automatic Variables - GNU `make' 10.5.3 Automatic Variables Suppose you are writing a pattern rule to compile a ‘ .c ’ file into a ‘ .o ’ file: how do you write the ‘ cc ’ command so that it operates on the right source file name?

Automatic Variables - GNU `make'

You cannot write the name in the recipe, because the name is different each time the implicit rule is applied. Install CERN’s ROOT on Linux (Ubuntu 12.04) « Particle Physics and Code. There comes a time when all particle physicists must grab and install ROOT, and if I may say so what an amazing piece of kit it is.

Install CERN’s ROOT on Linux (Ubuntu 12.04) « Particle Physics and Code

You can do whole manner of things; plotting simple to more complex graphs using 3D visual libriaies, using the numerous built-in mathematics libraries including RooFit for advanced statistics analyses, utilising the parallel PROOF tools, to the powerful TMVA for multivariate analyses. Oh did I mention this is all FREE and I have barely scratched the surface with that pitiful list just mentioned. Of course it can ‘do your head in’ but that is just one of those things. Having around experienced users is always helpful and once you get used to it, well it becomes like driving, but instead of pollution you leave behind pretty plots and colourful rainbows.

I have supplied a shell script for Linux Ubuntu 12.04 users which installs the head development version of ROOT if you supply a parameter to the script called head. 4.2.2. Externally Managed Build — C/C++ Software Development with Eclipse. Build systems not managed by Eclipse.

4.2.2. Externally Managed Build — C/C++ Software Development with Eclipse

Recommended (needed) for existing projects.Any build system that supports command line build can be covered using this mechanism. (e.g. Programming Comments - How to install and use GCC g++ v4.7 and C++11 on Ubuntu 12.04. Summary I had a bit of extra spare time over the 2011 holiday season, and I wanted to test out some of the new C++11 features.

Programming Comments - How to install and use GCC g++ v4.7 and C++11 on Ubuntu 12.04

But I know the old GCC C++ compiler I have installed in my usual LTS Ubuntu 10.04 development environment is out-of-date, so the first thing I needed to do is upgrade my OS and GCC to something decent. Here is how I accomplished this task. Ubuntu 12.04 (beta) First thing was to change my operating system. Installing GCC v4.6. SmashTheStack IO - Level 5: Writing my first buffer overflow. Smashing the Stack for Fun and Profit by Aleph One. Why do environment variables not show up in Makefiles? Where does gcc look for C and C++ header files. Version control - Aborting a merge in Git. Use reentrant functions for safer signal handling. In the early days of programming, non-reentrancy was not a threat to programmers; functions did not have concurrent access and there were no interrupts.

Use reentrant functions for safer signal handling

In many older implementations of the C language, functions were expected to work in an environment of single-threaded processes. Now, however, concurrent programming is common practice, and you need to be aware of the pitfalls. This article describes some potential problems due to non-reentrancy of the function in parallel and concurrent programming. Signal generation and handling in particular add extra complexity. Dave Korn - RE: malloc mutex and exceptions.

This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.

Dave Korn - RE: malloc mutex and exceptions

Create a new Git Remote Repository from some local files (or local git repository) at A Waage Blog. So you have some files or a new Rails application, and you want to add this to a new shared remote Git repository.

Create a new Git Remote Repository from some local files (or local git repository) at A Waage Blog

(I’m assuming you have access to your server and are setting up a remote repo over ssh.) I know I can never remember how to do it, so here’s a post for me and hopefully you! Create a local Git repository in your application for your local files. #On local machine cd foo_project git init git add * git commit -m "My initial commit message" Now, create the repository on your Git server. Push to only bare repositories. Committed 01 Feb 2009 Typically Git allows you to build whatever kind of workflow you’d like.

push to only bare repositories

Instead of saying “you must use it this way”, Git lets you figure out what best works for you and your organization. Like every system though, there are caveats and gotchas, and this tip goes over one of them. Q & A: The difference between hard and soft links LG #105. By Lew Pitcher. How do I close the stdout-pipe when killing a process started with python subprocess Popen. Stack unwinding (stack trace) with GCC. I always liked the nice stack trace you get in some languages like java, c#, etc, with a nice clean trace of where the issue happent. Can we have this in C/C++ with gcc? Of course we can. Let’s use the following code in which we try to display our stack trace (assumes you are building it with -g to enable debug symbols): #include void dummy_function2() { // here will call our back_trace function to // display the back_trace } void dummy_function1() { dummy_function2 (); } int main(int argc, char **argv) { dummy_function1 (); } On some platforms, gcc has a built-in function called __builtin_return_address.

__builtin_return_address (LEVEL)’ This function returns the return address of the current function, or of one of its callers. The libunwind project - Bugs: bug #28397, compilation fails with gcc 4.4.2... [Savannah] Assembly Language Reference Manual. High Level Structure Module Structure LLVM programs are composed of Module‘s, each of which is a translation unit of the input programs. Each module consists of functions, global variables, and symbol table entries. Modules may be combined together with the LLVM linker, which merges function (and global variable) definitions, resolves forward declarations, and merges symbol table entries.

Here is an example of the “hello world” module: ; Declare the string constant as a global constant. @.str = private unnamed_addr constant [13 x i8] c"hello world\0A\00" ; External declaration of the puts function declare i32 @puts(i8* nocapture) nounwind ; Definition of main function define i32 @main() { ; i32()* ; Convert [13 x i8]* to i8 *... Profiling shared library on Linux using sprof. Ough. It's not as easy as one would expect. (Read here about valgrind if you don't want to use sprof.) First - FORGET ABOUT gprof. gprof is used for the applications but will NOT WORK for shared libraries. Sorry about that. I learned about it the hard way. Chapter 5: Building shared libraries with Libtool. The person who invented the concept of shared libraries should be given a raise... and a bonus. The person who decided that shared library management and naming conventions should be left to the implementation should be flogged.

Bitcoin 的基本原理. 昨天读到了 Bitcoin 的中文介绍,觉得非常有意思。 不过上面这篇文章解释的非常不靠谱,我花了一晚上去Bitcoin的官方网站 仔细研究了一下,总算理解了其原理。 Bash String Examples. Timeout a command in bash without unnecessary delay. Does python have a string contains method. 5 simple ways to troubleshoot using Strace. EECS 380: gprof Quick-Start Guide.