将std :: exception转换为EXCEPTION_POINTERS(Convert std::exception to EXCEPTION_POINTERS)
我可能完全误解了如何使用Google Breakpad API,如果是这种情况,我可以打开评论/建议/粗鲁的评论。 我正在尝试调用以下C ++函数:
bool WriteMinidumpForException(EXCEPTION_POINTERS* exinfo);
我有一个
std::exception
的引用:try { return QApplication::notify(receiver, event); } catch (std::exception &ex) { eh_.WriteMinidumpForException(?????); // ... do some more stuff and ultimately kill this process }
(
eh_
是google_breakpad::ExceptionHandler
。)我把什么放在?????
背景:这是必要的原因(我认为)是Qt不会支持在事件处理程序中引发的异常。 它不会正确传播,因此Breakpad生成的小型转储完全无用,因为异常的实际上下文已经丢失。 相反,您必须捕获所有异常,并在
QApplication::notify()
的重写中处理它们,这正是我正在尝试做的。 在发生异常的情况下,我想立即编写我的小型转储程序(这听起来像WriteMinidumpForException
会做),然后通知用户并退出应用程序。 但我不确定要传递什么作为EXCEPTION_POINTERS*
参数。I may be completely misunderstanding how to use the Google Breakpad API, and am open to comments / suggestions / rude remarks if that is the case. I am trying to call the following C++ function:
bool WriteMinidumpForException(EXCEPTION_POINTERS* exinfo);
I have a reference to a
std::exception
:try { return QApplication::notify(receiver, event); } catch (std::exception &ex) { eh_.WriteMinidumpForException(?????); // ... do some more stuff and ultimately kill this process }
(
eh_
is agoogle_breakpad::ExceptionHandler
.)What do I put in the ?????
Background: The reason this is necessary (I think) is that Qt will not support an exception thrown in an event handler. It will not propagate correctly, and thus the minidump that Breakpad produces is completely useless because the actual context of the exception has been lost. Instead, you must catch all exceptions and handle them in the override of
QApplication::notify()
, which is what I am trying to do. In the case of an exception, I want to immediately write my minidump for that exception (which is sounds likeWriteMinidumpForException
will do) and then notify the user and quit the application. But I am not sure what to pass as theEXCEPTION_POINTERS*
parameter.
原文:https://stackoverflow.com/questions/5315885
最满意答案
DateTime :: modify()将完全按照您的意愿执行。 它将很乐意接受字符串格式的时间并将其应用于对象: -
$date = new \DateTime(); $date->modify('07:30:28');
看它工作 。
或者,您可以一次性完成所有操作: -
$date = (new \DateTime())->modify('07:30:28');
DateTime::modify() will do exactly what you want. It will quite happily accept a time in string format and apply it to the object:-
$date = new \DateTime(); $date->modify('07:30:28');
Alternatively, you can do it all in one go:-
$date = (new \DateTime())->modify('07:30:28');
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
您不需要将字符串转换为时间戳记,以创建DateTime对象(实际上,它的构造函数甚至不允许您这样做,您可以告诉)。 您可以按照原样简单地将日期字符串提供给DateTime构造函数: // Assuming $item->pubDate is "Mon, 12 Dec 2011 21:17:52 +0000" $dt = new DateTime($item->pubDate); 话虽如此,如果你有一个你想使用的时间戳而不是一个字符串,你可以使用DateTime::setTimestamp() : $tim ...
-
datetime.strptime()不适合您的问题。 它将像“11月30日00”这样的字符串转换为struct_time对象。 你可以想要 from datetime import datetime t = 1322745926.123 datetime.fromtimestamp(t).isoformat() 这段代码的结果是 '2011-12-01T14:25:26.123000' 如果你的时间码是一个字符串,你可以这样做: from datetime import datetime t = "1 ...
-
如何使用PHP 5.2从DateTime对象获取unix时间戳?(How to get a unix timestamp from DateTime object with PHP 5.2?)[2021-11-28]
$datetime = new DateTime(); echo $datetime->format('U'); 在行动中看到它 编辑 从PHP 5.4开始,您可以将其作为一个单行版本: echo (new DateTime())->format('U'); $datetime = new DateTime(); echo $datetime->format('U'); See it in action edit As of PHP 5.4 you can make this a one-liner: ... -
DateTime :: modify()将完全按照您的意愿执行。 它将很乐意接受字符串格式的时间并将其应用于对象: - $date = new \DateTime(); $date->modify('07:30:28'); 看它工作 。 或者,您可以一次性完成所有操作: - $date = (new \DateTime())->modify('07:30:28'); DateTime::modify() will do exactly what you want. It will quite happi ...
-
您可以创建DateTime实例,指定它是UTC。 然后使用setTimeZone()将其时区更改为用户的时区。 $datetime = new DateTime("2011-06-07 12:34:56", new DateTimeZone("UTC")); $datetime->setTimeZone(new DateTimeZone("Europe/Berlin")); echo $datetime->format(DateTime::RSS); You can create the DateTime ...
-
如果您可以安全地删除纳秒,那么您可以使用随机字节 格式代码来计算额外的数字: $input = 'Apr 3, 2015 16:58:46.461897000'; $output = DateTime::createFromFormat('M j, Y G:i:s.u???', $input); var_dump($input, $output); string(31) "Apr 3, 2015 16:58:46.461897000" object(DateTime)#1 (3) { ["date ...
-
strtotime函数将假定datetime在服务器的本地时区。 The strtotime function will assume the datetime is in the server's local timezone.
-
DB2时间戳PHP DateTime(DB2 timestamp PHP DateTime)[2022-10-07]
我认为你的函数(无论哪个)在日期字符串末尾的微秒上窒息。 使用DateTime::createFromFormat()函数使用'u'微秒标记来处理这个问题。 见http://php.net/manual/en/function.date.php $time = DateTime::createFromFormat('Y-m-d-h.i.s.u', '2010-12-15-10.23.22.716000'); var_dump($time); 我的系统输出: - object(DateTime)[1] ...