I want to know exception context save in Armv8-A aarch32 - exception

I know that registers r0~r3,r12,PSR,LR are saved when an exception call occurs in cortex-m.
But I'm confused that exception call in cortex-A
Q1. When a exception call occurs in cortex-A, it only saved LR and CPSR register?
Q2. If I want to save the context to the stack, do I have to add the code myself?

Related

Aapche-Camel save error information on each retry

I have an Apache Camel route which handles messages from a queue. To better understand what is happening at runtime I also keep the execution state in a database (number of retries, last execution state,...). I would like to use the redelivery mechanism from the exception handler but which performs some processing on every failure to update my database record.
from("jms:myinputqueue")
.onException(RetriableException.class)
.maximumRedeliveries(5)
.maximumRedeliveryDelay(10000)
.useOriginalMessage()
.to("log:store error information in database about each attempt") // (1)
.end() // onException
.to("log:apply business logic here which can throw exceptions")
;
The part (1) is only executed after all retries are exhausted, so only once.
I've read Apache Camel- Message Redelivery happens before onexception block executes but the suggested solution ''onRedelivery'' is executed before the beginning of a new retry. I need to store the result on each failure so I can save the last state (error message) in the database.
Any suggestions ?
There is an onExceptionOccurred processor you can use that is called when the exception happened.
Its included in Camel 2.17 onwards: https://issues.apache.org/jira/browse/CAMEL-9069

Is it possible to dump local variables value in VEH or SEH exception handler?

Is it possible to dump local variables value in VEH or SEH exception handler?
In the exception context, we can get the registers SS,SP,BP... Can I get the local vairable value by these registers? and how?
If we return EXCEPTION_CONTINUE_EXECUTION in the exception handler, the function will continue execution, the local variables still in memory(stack) when the exception handler running? Can I retrieve the local variables by ReadProcessMemory() in the exception handler?
Update:
Can I get full dump in the exception handler and search the local variable value in the dump file? I can know part of the variable value.

BizTalk What does mean segment and progress from "Exception thrown from: segment X progress Y" communicate

What does 'segment' and 'progress' mean in that kind of exception
2) xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'MainEventProcess.MainEvent(5b530a24-7336-4695-78ee-1d4ffdd9f210)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: cf584087-a9d3-4be7-8da7-eae49fd4a108
Shape name: SendDeviationOut
ShapeId: dc5c3484-7955-4d75-b1f9-7e0ca8ecbc1e
Exception thrown from: segment 4, progress 8
Inner exception: Exception occurred when persisting state to the database.
Full details hereon MSDN:
Exception during execution of Orchestration
Can it be helpful in searching errors in code?
First, it's nothing you need to worry about and is not related to your app/code/implementation.
The two items you need to act on are SendDeviationOut and Exception occurred when persisting state to the database. You are most likely publishing a message and there are no Subscribers. This is the "no Subscribers found" error from the Orchestration engine.
Now, to answer your specific question, those are markers to blocks of C# code that XLang compiler generated from your Orchestration. Basically, every statement is organized into a group, segment, and each is executed and tracked individually, progress. If you open the File0.cs, you will see this in action.

Exceptions in Lablgtk callbacks

In Lablgtk, whenever there is an exception in a callback, the exception is automatically caught and an error message is printed in the console, such as:
(prog:12345) LablGTK-CRITICAL **: gtk_tree_model_foreach_func:
callback raised an exception
This gives no stack trace and no details about the exception, and because it is caught I cannot retrieve this information myself.
Can I enable more detailed logging information for this case? Or prevent the exception from being caught automatically?
I guess the best way to do so is to catch your exception manually and handle it yourself.
let callback_print_exn f () =
try f () with
e -> my_exn_printer e
Assuming val my_exn_printer : exn -> unit is your custom exception printer, you can simply print your callbacks exceptions by replacing ~callback:f by ~callback:(callback_print_exn f) in your code.
Of course, you can also with that method send that exception to another
thread, register a "callback id" that would be passed along with your exception...
About the stack trace, I'm not sure you can retrieve it easily. As it's launched as a callback, you probably want to know the signal used and that can be stored in your callback handler.
I had another similar issue, but this time it was harder to find where to put the calls to intercept the exception.
Fortunately, this time there was a very specific error message coming from the Glib C code:
GLib-CRITICAL **: Source ID ... was not found when attempting to remove it`
Stack Overflow + grep led me to the actual C function, but I could not find which of the several Lablgtk functions bound to this code was the culprit.
So I downloaded the Glib source, added an explicit segmentation fault to the code, compiled it and used LD_LIBRARY_PATH to force my modified Glib version to be loaded.
Then I ran the OCaml binary with gdb, and I got my stack trace, with the precise line number where the Lablgtk function was being called. And from there it was a quick 3-line patch.
Hacks like this one (which was still faster than trying to find where to intercept the call) could be avoided by having a "strict mode" preventing exceptions from being automatically caught. I still believe such a switch should be available for Lablgtk users, and hope it will eventually be available.

How do I log a general exception to the Event Log?

I have a windows service, in which I want a top level try-catch that catches any otherwise unhandled (or bubbled) exception, logs it to the Event Log and then swallows it so the service keeps running. However, I can't find any overload to System.Diagnostics.EventLog.WriteEntry that takes an exception as a parameter - is there no way to just give the event log the exception and let it parse out the message on its own?
Unfortunately there is no standard way of just passing the Exception to the Eventlog, built in to the .NET framework.
To have an exception written to the EventLog with the smallest development effort, you would need to write something like:
EventLog myLog = new EventLog();
myLog.Source = "Your Source";
myLog.WriteEntry(exception.ToString(), EventLogEntryType.Error);
But normally you would try to do some formatting of your exception.