Why is IDA Pro in batch mode slowing down during runtime? - runtime

I am running IDA Pro in batch mode on a Windows machine (idaw64.exe). executing the following command line very often to analyse a lot of files.
idaw64 -c -A -Smatcher.py arg1 arg2 arg3
I need to disassemble the input file and run the script matcher.py on this disassembled files. The execution of this task works fine and I get the expected results.
But as I need to execute this procedure (disassembly + script) very often (ca. 40.000 times) I am caring a lot about runtime of one procedure. The execution slows down from 10s to 2min for one procedure, whereas the disassembled files do not really change and the script also remains the same.
What causes this slow down? How can I speed it up?

Related

Gps python 2 program crashs bash file execution, raspberry pi

I have recently encountered a problem with executing python scripts on the Raspberry Pi using bash files. I have two programs, the first need not be mentioned as there are no problems running it. The second however reads GPS data from my USB GPS receiver and once it has been executed from a bash file based in the terminal it ends the running of the infinite loop bash file. It is in python 2 and the first program is in python 3. I cannot combine them into one program as the GPS program is not supported in python 3 due to modules not being updated. The code for the GPS program can be found here.
The only difference my code has is that I use a while loop to make it execute 10 times instead of infinitely. I want to prevent this program ending the bash file prematurely so it runs infinitely. I've tried running the bash file from another bash file so if a crash happens the script would be restarted but it seems that the terminal no longer takes any inputs after the GPS program has finished executing. Any help on this would be appreciated greatly!
My bash file looks like this:
#!/bin/sh
while true; do
echo "Running programs"
sh ./programtimer.sh
sleep 20
done
programtimer.sh simply runs the two python programs, the GPS program being run second.

Bash Pipe File-Redirect Prints �

I have a program that runs and I pipe the output to a file.
program > file.txt
The above command is run every half hour. One time it printed new data, followed by about a page of �, and then old data. I'm curious on why this happened, or how this happened. It's been running for ~3k times and failed this one time. Did the OS (mac) just hickup?
The program is maven and it runs some automation code (e.g. mvn clean test -Dtest=XYZ). If the maven fails then it will re-run the same command again (pmvn clean...). I am not sure how to duplicate this. Since it has happened it has been running fine.
This is almost certainly not an issue with bash or your OS, but with the program you're running. The � symbol means that your program is outputting something that doesn't consist of printable characters. Either it's outputting binary data rather than text (whether by design or otherwise), or an error's occurring that causes its textual output to be garbled.

What happens while launching /bin/sh?

Suspecting /bin/sh launching taking considerable boot ticks on my embedded linux kit.
In the kernel, /bin/sh being launched from kernel_init().
Will it look for start-up scripts?
If so, what would be the name of the scripts?
How is possible to measure the boot-up time of /bin/sh?
To measure the run-time of a command, you can prefix it with the time command. In this case
time /bin/sh -c exit
would be useful for you. It starts /bin/sh, which then immediately runs the exit command, so the time you will get is the startup time plus the termination time of sh. Alternatively, you might be interested in the strace command, which prints all the system calls initiated by the program it runs. This is a way to guess if sh tries to open any files, through examinig stat and/or open calls. strace works in the same way as time. I hope it helps.
Regards

mpirun OpenFOAM parallel app in gdb

I'm trying to step through an OpenFOAM application (in this case, icoFoam, but this question is in general for any OpenFOAM app).
I'd like to use gdb to step through an analysis running in parallel (let's say, 2 procs).
To simply launch the app in parallel, I type:
mpirun -np 2 icoFoam -parallel
Now I want to step through it in gdb. But I'm having trouble launching icoFoam in parallel and debugging it, since I can't figure out how to set a break point before the application begins to execute.
One thing I know I could do is insert a section of code after the MPI_Initialize that waits (and endless loop) until I change some variable in gdb. Then I'd run the app in parallel, attach a gdb session to each of those PIDs, and happily debug. But I'd rather not have to alter the OpenFOAM source and recompile.
So, how can I start the application running in parallel, some how get it to stop (like at the beginning of main) and then step through it in gdb? All without changing the original source code?
Kindest regards,
Madeleine.
You could try this resource
It looks like the correct command is:
mpirunDebug -np 2 xxxFoam -parallel

How do I call Matlab in a script on Windows?

I'm working on a project that uses several languages:
SQL for querying a database
Perl/Ruby for quick-and-dirty processing of the data from the database and some other bookkeeping
Matlab for matrix-oriented computations
Various statistics languages (SAS/R/SPSS) for processing the Matlab output
Each language fits its niche well and we already have a fair amount of code in each. Right now, there's a lot of manual work to run all these steps that would be much better scripted. I've already done this on Linux, and it works relatively well.
On Linux:
matlab -nosplash -nodesktop -r "command"
or
echo "command" | matlab -nosplash -nodesktop
...opens Matlab in a "command line" mode. (That is, no windows are created -- it just reads from STDIN, executes, and outputs to STDOUT/STDERR.) My problem is that on Windows (XP and 7), this same code opens up a window and doesn't read from / write to the command line. It just stares me blankly in the face, totally ignoring STDIN and STDOUT.
How can I script running Matlab commands on Windows? I basically want something that will do:
ruby database_query.rb
perl legacy_code.pl
ruby other_stuff.rb
matlab processing_step_1.m
matlab processing_step_2.m
# etc, etc.
I've found out that Matlab has an -automation flag on Windows to start an "automation server". That sounds like overkill for my purposes, and I'd like something that works on both platforms.
What options do I have for automating Matlab in this workflow?
matlab -nosplash -nodesktop -r "command"
works on Windows as well. Yes, it opens another window, but it's not a problem. I run it in a batch mode from Java wrapper on Tomcat server and there were no issues. Put all commands into a script file, don't forget to close the session with exit command, and use -r flag. Also you can find -noFigureWindows and -wait parameters useful. And it works on both Windows and Unix. You can use platform-specific flags, if some are not supported they will be ignored.
Start MATLAB program (Windows platforms)
There is also a way to hide matlab window with C library. See engSetVisible.

Resources