I have this weird error. I'm trying to compile a HLSL file, but my debugging isn't working properly.
Here's how I set up the error checking:
hresult = D3DCompileFromFile(vs_fn, 0, 0, "VShader", "vs_4_0", D3DCOMPILE_DEBUG, 0, &vertex_shader_blob, &error_message);
if (FAILED(hresult))
{
// If the shader failed to compile it should have writen something to the error message.
if (error_message)
{
auto error = (char*)error_message->GetBufferPointer();
return false;
}
}
However, my shader code does work. It displays how I want it too, but when I place a random character or change anything in the code to produce an error, nothing gets outputted to the error variable. It worked just the other day.
The check fails, it steps onto the if statement but never goes into it and just breaks to end of the entire code block. I'm confused.
Related
When doing some stuff with three.js I have noticed some limitations depending on what client the code is run on. One example is that if I have a lot of MeshPhongMaterials and Lights, and try it out on a low-end laptop/phone, I would get shader errors. Sometimes the requestAnimationFrame() would stop executing completely and sometimes I would just get walls and walls with this error (and WebGL warnings).
My question is if it is possible to catch these errors? Made a little stress-test script using try-catch but the catch is never called even after the errors and warnings.
var rendering = function()
{
lights.push(new THREE.PointLight());
lights[lights.length-1].position.set((Math.random()*10)-5,(Math.random()*10)-5,(Math.random()*10)-5);
scene.add(lights[lights.length-1]);
try
{
renderer.render(scene,camera);
}
catch(e)
{
console.log("Limit!"); // never shown
}
requestAnimationFrame(rendering);
}
console.error = yourFunction()
console.warning = yourFunction()
Examine the messages in there, and do something with them..
I am porting a CPU code to GPU with OPENACC,
the routine returns exit code
int myFunction()
{
// so stuff
// it has a check for division by zero
int returnVal=SUCCESS;
if(fabs(a)<1e-14)
{
returnVal=1;
}
return(returnVal);
}
adding the
#pragma acc routine seq
int myFunction()
{
// so stuff
// it has a check for division by zero
int returnVal=SUCCESS;
if(fabs(a)<1e-14)
{
returnVal=1;
}
return(returnVal);
}
will give the following error,
call to cuStreamSynchronize returned error 719: Launch failed (often invalid pointer dereference)
call to cuMemFreeHost returned error 719: Launch failed (often invalid pointer dereference)
Primary job terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
If I eliminate the return by changing it to void, it works fine,
what is the correct way of doing this ?
I do understand the race condition, given the fact that this is called inside a loop, should I privatize the return value and then perform a reduction on it?
When running the following snippet of VSTO code I get a COM exception
if (param.SelectedShape.Type != MsoShapeType.msoPlaceholder) { //Stuff is happening }
The exception occurs when trying to read the Type property of SelectedShape.
We have been running with this code in PowerPoint (Office 365 ProPlus) for a long time, but somewhere between build 9126.2210 (works) and build 9330.2087 (doesn't work) it broke.
When looking through the release notes it doesn't seem like anything has been changed that should be related to this. What could have been changed?
You might try to use the call in a try/catch block like here:
try
{
if (param.SelectedShape.Type != MsoShapeType.msoPlaceholder)
{
// Stuff is happening
}
}
catch (COMException)
{
// Add logging here
}
This is a workaround. Of course, Microsoft should fix the problem.
I have a problem with the following code example:
Windows::Storage::StorageFolder^ location = Package::Current->InstalledLocation;
try
{
task<StorageFile^> GetFileTask(location->GetFileAsync(sn));
GetFileTask.then([=](StorageFile^ file)
{
try
{
task<IBuffer^> ReadFileTask(FileIO::ReadBufferAsync(file));
ReadFileTask.then([=](IBuffer^ readBuffer)
{
// process file contents here
});
}
catch(Platform::Exception^ ex)
{
// Handle error here
}
});
}
catch(Platform::Exception^ ex)
{
// Handle error here
}
When using a filename that doesn't exist the function throws an exception:
Unhandled exception at 0x0FFCC531 (msvcr110d.dll) in GameTest2.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.
I've been searching the internet and this exception breaks only when connected to the debugger. I'm using VS 2012. I've turned off all the relevant 'break on exception' but it still causes the debugger to break and non of my handlers are getting a chance to handle the exception.
If the file is missing I would expect the GetFileAsync method to throw a 'File doesn't exist' exception. Not sure why it keeps throwing the 'Invalid parameter' exception.
This is starting to bother me and I just can't find any known solution to this issue. Anyone have any ideas?
I'm going to try and change the method to not use the task<> code. Instead I'll call the GetFileAsync using 'await'. However I believe 'await' will just cause the calling thread to wait until the GetFileAsync has finished, which kind of defeats the point of asynchronous loading.
I'm wondering if this is a common issue with exception handling when using tasks.
Update:
OK, I've now found the solution:
task<StorageFile^>( location->GetFileAsync(sn)).then([](StorageFile^ openedFile)
{
return FileIO::ReadBufferAsync(openedFile);
}).then([](IBuffer^ readBuffer)
{
// Process file
}).then([](task<void> t)
{
try
{
t.get();
}
catch(Platform::Exception^ e)
{
// Handle error
}
});
It seems there needs to be an extra 'then' condition added to the end of the chain to pick up the exception.
I would like to exit out the current method that I'm stepping through.
-(void)helloWorld {
NSLog(#"Hello");
// I would like to return here, so that "World" isn't printed.
NSLog(#"World");
}
I have tried the following, but without luck.
(lldb) expr return
<no result>
Is this possible with lldb?
Unfortunately in Xcode 4.5.x there is no way to force an early return from a function. In the current lldb sources over at http://lldb.llvm.org/ there is a newly added command, thread return, which does what you want - it includes the ability to specify the return value of the function. This won't be in Xcode until the next major release, though.
When you are debugging using Xcode and when your program is paused at a breakpoint, you can drag the little green arrow to any other line in the function. E.g. in the following code:
if I want to skip the NSLog(#"B"), I can simply drag the green arrow from line 20 to line 23, which means the function will simply "return" from anywhere I want.
I just added a breakpoint at the line mentioned below:
var computed: Bool {
return device.time == 10 // added breakpoint here
}
and got the following error:
error: Error returning from frame 0 of thread 1: We only support
setting simple integer and float return types at present..
Seems to work for only those two types