[PATCH] record: Add support for interrupt handlers

Chris Johns chrisj at rtems.org
Thu Sep 5 05:29:36 UTC 2019


On 5/9/19 2:42 pm, Sebastian Huber wrote:
> ----- Am 5. Sep 2019 um 0:28 schrieb Chris Johns chrisj at rtems.org:
> 
>> On 4/9/19 9:46 pm, Sebastian Huber wrote:
>>> On 04/09/2019 08:06, Chris Johns wrote:
>>>>> +void LTTNGClient::WriteIRQHandlerExit(PerCPUContext* pcpu, const ClientItem&
>>>>> item) {
>>>>> +  pcpu->content_size += kEventIRQHandlerExitBits;
>>>>> +  pcpu->packet_size += kEventIRQHandlerExitBits;
>>>>> +
>>>>> +  EventIRQHandlerExit& ih = pcpu->irq_handler_exit;
>>>>> +  ih.header.ns = item.ns;
>>>>> +  ih.irq = static_cast<int32_t>(item.data);
>>>>> +  fwrite(&ih, sizeof(ih), 1, pcpu->event_stream);
>>>> https://en.cppreference.com/w/cpp/io  :)
>>>
>>> I had a look a this, it seems the error reporting capabilities of <fstream> are
>>> quite bad (nothing like strerror(errno)).
>>
>> Interesting point to make given the return code from `fwrite` is not checked. :)
> 
> Yes, but at least the return status of fopen() is checked.

There is `bad()` and you can trigger exceptions. There are usable options and my
link was only a question and not a requirement.

> 
>> Also it should be `std::fwrite`.
> 
> Ok, it seems <stdio.h> was included via <iostream>. I will fix this.
> 

I think we can take C++ development styles offline and chat personally, maybe in
person soon. :)

Chris



More information about the devel mailing list