I'm trying to call execl within my iOS application, which is running in the iPhone Simulator. But that fails. Xcode shows this error:
error: address doesn't contain a section that points to a section in a object file
When going step by step, this error pops up at the moment when I try to step into execl.
So, this makes me think that there is a problem with that very specific method. That it actually doesn't exist in the compiled executable? Do I need to link specific libraries? I tried this as well:
printf("execl(): %llx", &execl); // get the address of that method
Which prints values like: execl(): 3aeee0e. However, when debugging it states: EXC_BAD_ACCESS and Thread 1: 0x0000000.
Any ideas? I also tried methods like execve(), but give the exact same result. In the past, the exact same code work perfect.
For those who know what I'm talking about: Yes, I really want to use valgrind and not the tools by Apple.
Related
I am trying to write a DYLIB, (in Code::Blocks), which is to be called from a Mac application, that simply calls the standard C system() function, while giving the option of whether to wait for finishing, in the second argument, (1 or 0).
I put my sample code on pastebin, instead of embedding it here, because for whatever reason, the post editor is not letting me place the entire code snippet inside the code box, like it's supposed to, which is a little annoying.
http://pastebin.com/0ZfbD3Dx
Now when calling the DYLIB, (I can't remember the compiler I used, either GCC or LLVM), I use this code within GameMaker Studio:
ExecuteShell('open /Applications/Calculator.app',0);
However, calculator does not run. Trying to change the second argument to 1, and I get the same result. Calculator does not run. No errors. It seems to be ignoring my code all together, so I was wondering if there was something wrong with how I wrote my DYLIB.
I look at this question someone else had:
https://stackoverflow.com/questions/859517/osx-equivalent-of-shellexecute#=
string command = "open " + filePath;
system(command.c_str());
I see they used .c_str(). Should I be using .c_str()? Is that the problem? The code I use right now is system(fname);. Should I change that to system(fname.c_str());? Is it OK that I'm using the type char * for the argument fname? Or because I'm using that type, do I have to cast/convert it to the type string?
I'm using someone else's Mac to port this small project of mine to work on Mac, anyway I'm trying to get help on here, before trying to build it again, because I'm trying to minimize how much I'm asking to use my friend's Mac computer. The hope is, the next build I do, with very little tweak, will finally work and run calculator.
Thanks in advance!
I have a testing utility that uses linux aio_write and aio_read.
This testing utility wraps my static library and test it. This library is multi-threaded black box.
Up until now, it worked fine. But now we made a big change into the this black-box which causes the testing utility to fail as soon as it commits the first IO.
This IO returns with errno 22 == EINVAL.
Based on the aio_write man pages, this error is issued in case one of the following fields is invalid --> aio_offset, aio_reqprio, aio_nbytes.
I run it inside gdb and tested their values as long as with all other values inside the struct aiocb * input parameter.
My conclusion is that the input parameters are all valid.
I suspect something has changed in the way threads are working inside the black-box. This is what i suspect causing this issue (i can not find any other explanation).
What I really try to understand is: Which scenarios causes aio_write() to return a EINVAL error code???
Just to clarify, when I replace the black-box to an older version, using the same testing utility it works fine.... (i also tested the input arguments here as saw they are matching to the bad version input arguments).
You can take a look at the aio implementation in the linux source code at the folder linux-kernel-source/fs/aio.c
Sadly there are a lot of points where -EINVAL is returned. As #myaut mentioned in his comment, I recommend you to use strace. Another solution would be to modify the code, compile it and check where it fails.
Question Intro
I'm running an opencv project in Visual Studios 2010 and have implemented cuda support (refer to my previous question for precise info on my set-up). All cuda-functionalities are working fine - to the best of my knowledge - and are indeed improving speed on the image processing.
However, I now also wanted to attemp to speed up the video-writing function in this project by replacing the current cv::VideoWriter with the gpu::VideoWriter_GPU function. The reason for this is that the cv::VideoWriter seems to somehow cause processes running outside of the scope in which the VideoWriter is called to be slowed down, resulting in images available at the DirectShow driver being dropped by the VideoCapture-function, hence messing up an algorithm I've implemented.
Problem
To attempt to solve this issue, I've now replaced the VideoWriter-calls with VideoWriter_GPU-functionality (and corresponding syntax), but when I run my project (Compile & Run in Debug-mode), I get the following error-message (directly originating atthe calling of gpu::VideoWriter_GPU):
OpenCv Error: The function/feature is not implemented (The called functionality
is disabled for current build or platform) in unknown function, file
c:slave\builds\wininstallermegapack\opencv\modules\gpu\src\precomp.hpp, line 131.
and the program then ends with
code -529697949 (0xe06d7363)
I've purposely currently not included any of my code because the error-message originates so clearly from the call to the gpu::VideoWriter_GPU, which is making me think it's not a coding or syntax problem. (Please comment if you feel my code is necessary for answering this question.
My steps so far
I miss the natural gift of understanding what precisely this message means or how to interpret it. Does my opencv v2.4.4 simply not support what I want...? Does this function simply not work on my windows 7, 64bit system...?
I've checked out as many available google-hits I could find (relating to this error message and combinations of searchterms like "opencv, gpu, VideoWriter_GPU, disabled for current build") but have not understood what the problem is or how to solve it.
Corresponding header-file and error message can also be found here.
This post and this post suggest the error message is trying to tell me that opencv simply does not provide the option of using the function or functionality I am aiming to use. Or maybe even that cuda is not at all supported.. But that's all against my experience as every single opencv gpu-function I've tried to use has seemed to work fine.
Question
Could someone please explain to me why this is not working for me, and more importantly share with me what I should do to make the VideoWriter_GPU work?
Many thanks!
Maybe this link can give you a little idea of what the problem is: VideoReader_GPU not available, but built with NVCUVID?.
It seems to be that the problem is the CUDA_DISABLER var.
I am working on this problem for two days and this is driving me mad as I am still quite new to C++. This violation access problem may be quite easy to you and may be answered thousands of times. But my lack of C++ knowledge make me even unable to identify the same problem ever answered.
OK here is my problem:
1. The major code is in a DLL. I am using Visual Studio 2008
2. This DLL called 3 external libraries: boost, tinyXML and SRILM (a NLP toolkit).
3. The error says: Unhandled exception at 0x5f4f068f (TextNormalizerAPI.dll) in tester.exe: 0xC0000005: Access violation reading location 0x00000000. , occurred only in Debug mode. And the error line was caused by an initialization of a boost::regex object (patUsername = regex("^\\W*#[A-Za-z]");) in my code, but the actual position was deeply inside the boost library, as shown in below figure:
**in most cases, I am not supposed to change the source code of Boost lib, isn't it? **
4. This error occurred only in Debug version, not in Release version.
5. I replace the whole solution with a old but fault-free version which worked properly in Debug mode. Yet immediately after I generating a Release version of this solution, error occurred in Debug mode!
UPDATE:
6. Thank you guys! I just tried something and found out that even a simple define a regex object in the first line of the entry of DLL will incurred this error! Any ideas?
7. yet initialize a regex object in the first line in the main() of the caller of this dll will not incur this problem.
Hope this description will help you recall something and give me some hint.
I want to ask:
what's the usual strategy to narrow down and spot the problem? thank you!
Looking at your code, you may want to verify that your m_position values are valid ... I'm seeing a escape_type_class_jump label in your code, so the goto or whatever mechanism you're using to jump to that label (I can't tell from the screen-shot) may be bypassing whatever checks are being done to verify that your position increments are still valid.
It looks to me like "this" (i.e., the basic_regex_parser) is NULL, and it's trying to call a method on a NULL object, which obviously doesn't work well. If "this" is indeed NULL (you can tell by looking in the "Locals" tab, then I would go up the call stack to the "basic_regex_implementation" level and see what's going on there -- where is this NULL value coming from? In general, looking at different levels of the call stack, and at the variables' values in those levels, will be helpful.
I am debugging an Iphone program with the simulator in xCode and I have one last issue to resolve but I need help resolving it for the following reason: when it happens the program goes into debugging mode but no errors appear (no BAD ACCESS appears) and it does not show where the code fails. Putting some variables as global helps me to see their values to start pin pointing where the bug is but before I go into this fully I would like to know what techniques/tools you guys use to debug these situations.
If it helps Im debugging the following: I merged some code into the SpeakHere demo. The code was added in the C++ modules of the program (AQRecorder.h and .mm). I seem to have pinpointed the problem code in a function I wrote.
My favourite is always to add debugging code and log it to a file. This allows me so report any and all information I need to resolve the issue if the debugger is not working properly.
I normally control the debugging code by use of a flag which I can manipulate at run time or by the command line.
If the error is (and it probably is) a memory management issue, printing log entries is really not going to help.
I would reccomend learning how to use Instruments, and use its tools to track down the memory leak when it occurs rather than waiting until the application crashes later on.