DebugBreak in Unix/ Linux? - unix

Do we have similar windows API of DebugBreak in Unix/ Linux. I want to debug a daemon process which should open NetBeans when DebugBreak statement is executed. Thanks in advance.

there is __builtin_trap() GCC intrinsic.

Whav! this is what I am looking for Embedded break points in C http://mainisusuallyafunction.blogspot.in/2012/01/embedding-gdb-breakpoints-in-c-source.html and to get sample program have a look in to https://github.com/kmcallister/embedded-breakpoints

Related

HCI_UART on NRF52840, attaching the device on a Yocto based Linux SBC errors out saying "Can't init device hci0: Cannot assign requested address (99)"

I am trying to Interface a BLE module based on Nordic's nrf52840 to a Yocto based SBC, to which all the BlueZ related packages have been added.
I have flashed Zephyr's sample hci_uart program onto the module. The module seems to run perfectly on my Linux PC (BlueZ version 5.48), whereas on the SBC(BlueZ version 5.54) it fails to get inited. Here's the error that comes when I use
root#rb-imx6:~# hciconfig hci0 up
root#rb-imx6:~# Can't init device hci0: Cannot assign requested address (99)
Can anyone please help me out on this?
Thanks in advance.
The error of assigning an address is caused by missing Linux kernel configuration options:
CONFIG_CRYPTO_USER
CONFIG_CRYPTO_USER_API
CONFIG_CRYPTO_USER_API_AEAD
CONFIG_CRYPTO_USER_API_HASH
CONFIG_CRYPTO_AES
CONFIG_CRYPTO_CCM
CONFIG_CRYPTO_AEAD
CONFIG_CRYPTO_CMAC
This is likely to happen with a self-built Buildroot or Yocto Embedded Linux system. If you run into this error, you should enable above options and recompile the kernel.
See the BlueZ requirements here: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/README#n64
To see detailed debug output from BlueZ, run it with -d option:
bluetoothd -d

What AddressSanitizer flags should I use to detect more errors?

What Asan flags should I use to detect more errors? At the moment, I use ASAN_OPTIONS=detect_stack_use_after_return=1.
From Asan FAQ:
Q: Can I run AddressSanitizer with more aggressive diagnostics enabled?
A: Yes! In particular you may want to enable
CFLAGS += -fsanitize-address-use-after-scope
ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
Check https://github.com/google/sanitizers/wiki/AddressSanitizerFlags for more details on this.
In command line add these options when compiling :
-fsanitize-recover=address -fsanitize=address
When running the executables add these options :
ASAN_OPTIONS=halt_on_error=0 ./your_executable_name
These Options I tried On Ubuntu,In Windows I am still finding answer.

How to use Intel Pin on MPI code

I am pretty new to MPI and Intel Pin. I already installed pin-2.13-62732-gcc.4.4.7-linux on my linux environment, I need t use this tool on MPI codes. foreexample I want to get the number of instruction(such as inscount0 which is already existed in pin) of MPI code (like imul.c). Would you tell me what I can do?
The least painful way I found is to use tau_pin. https://www.cs.uoregon.edu/research/tau/docs/old/re39.html
You can start analysis of your MPI application following way:
mpirun –np $NPROCS pin -t $PIN_TOOL -- $APP
It the same as in case of Valgrind: Using valgrind to spot error in mpi code

Hostapd start error

make wthis this manual
http://wireless.kernel.org/en/users/Documentation/hostapd
with this config file
interface=wlan2
bridge=br0
driver=nl80211
ssid=SupaAP
country_code=RU
hw_mode=g
channel=5
preamble=1
macaddr_acl=0
auth_algs=1
logger_syslog=-1
logger_syslog_level=3
logger_stdout=-1
logger_stdout_level=2
ignore_broadcast_ssid=0
ieee80211n=1
ht_capab=[SHORT-GI-20][RX-STBC1]
wmm_enabled=1
and i have error
oot#Cubian:/home/cubie/wif/hostapd-2.1/hostapd# ./hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Line 16: unknown configuration item 'ieee80211n'
Line 17: unknown configuration item 'ht_capab'
2 errors found in configuration file '/etc/hostapd/hostapd.conf'
Failed to set up interface with /etc/hostapd/hostapd.conf
Failed to initialize interfac
in old version i dont have thsi error
It appears that the problem is that hostapd 2.1 is now treating an error it had differently.
This is reproducible on Ubuntu desktop versions, as the resource (WLAN) is busy.
If one turns off the programs that are accessing the resource, hostapd has a chance to grab it and work.
In Ubuntu desktop 14.04 beta, a solution is to turn off the programs that are using the wlan in question.
This worked for me:
sudo nmcli nm wifi off
sudo rfkill unblock wlan
then hostapd can start normally from command line. Of course, if you want hostapd to start on boot you must insure that the network manager is not grabbing the resource ahead of time.
SOLVED
in compile conf i uncomment string
CONFIG_IEEE80211N=y
I have found this link explaining the cause of the error and how to solve it.
https://bugs.archlinux.org/task/20269
Also I have found this other link http://blog.mirjamali.com/en/IT/Linux/hostapd which I followed and it is working with me check the configuration part.
My OS is ubuntu 12.4
start your hostapd with
hostapd -dd /etc/hostapd/hostapd.conf
you will get more information for diagnostics. In which old version you did not get the error? Did you update hostapd? Or changed your wifi adapter? which distri you are using?
http://hostap.epitest.fi/cgit/hostap/plain/hostapd/hostapd.conf
there is written how the ieee80211n settings are. for me i cant see an error.
if you remove the both lines, the ap is starting correctly?

Issues in running R from Perl

I want to include Statistics::R for my program.
The statement I am including is:
use Statistics::R;
Is there something wrong with it?
I tried to run it with just this statement included, the error i got was
Can't locate Statistics/R.pm in #INC(#INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at rperl.pl line 2
By the way I am using perl(v5.14.2) on ubuntu,using remote access to a linux server.
The solution was to install the module as non-root user.
The details are provided in the following link:
http://users.soe.ucsc.edu/~you/notes/perl-module-install.html
After doing the things described here, a couple of small steps are to be completed which are mentioned in the following link:
http://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations
This worked for me! I hope it would be of help to others too!

Resources