ROSCore/src/PCMemoryDataChannel.cpp BUG

在if语句外定义了ed,赋值为m_eventInputManager->getById(ticket)的返回值,如果未找到对应的Event Descriptor,则返回EventInputManager::EIM_MAYCOME或者EventInputManager::EIM_NEVERTOCOME。

在if语句内也定义了ed, 赋值为m_eventInputManager->getEventDescriptor(mem_page)返回值,这是根据造的空数据的内存内存地址得到对应的event descriptor,并修改该ED的值为ticket,然后根据ticket将该ed放进对应的List。

但是if语句里有对丢失数据的状态判断,这应该是用到的if外的ed值。在if语句重新定义ed后,覆盖了该if外的ed值,???此处是不是有bug?

178 /**************************************************************/
179 ROS::EventFragment* PCMemoryDataChannel::getFragment(int ticket)
180 /**************************************************************/
181 {
182   evDesc_t *ed;
183   MemoryPage *mem_page;
184   EventFragment *fragment=0;
185
186   DEBUG_TEXT(DFDB_ROSFM, 10, "PCMemoryDataChannel::getFragment: fragment with L1ID " << ticket << " requested");
187   // protect EIM and fast allocate with same mutex
188   m_mutex->lock();
189
190   //Find the requested event
191   ed = m_eventInputManager->getById(ticket);
192
193   if (m_fragType == 0)
194   {
195     DEBUG_TEXT(DFDB_ROSFM, 10, "PCMemoryDataChannel::getFragment: processing ROB fragment");
196     if((intptr_t)ed == EventInputManager::EIM_MAYCOME || (intptr_t)ed == EventInputManager::EIM_NEVERTOCOME)
197     {
198     DEBUG_TEXT(DFDB_ROSFM, 8, "EIM_MAYCOME || EIM_NEVERTOCOME " << ticket <<  "ed:" << ed <<std::endl);
199     try
200     {
201       fragment = new ROBFragment(m_memoryPool, ticket, m_sourceIdentifier, 0); //create an empty ROB fragment
202       Buffer *mem_buffer = fragment->buffer();                                 //get the Buffer of the ROB fragment
203       Buffer::page_iterator mem_page_i = mem_buffer->begin();
204       MemoryPage *mem_page = const_cast<MemoryPage *>(*mem_page_i);            //get the memory page of the buffer
205       mem_page->lock();
206
207       evDesc_t *ed = m_eventInputManager->getEventDescriptor(mem_page);        //get a pointer to the event descriptor
208       ed->L1id = ticket;                                                       //set the L1ID
209       m_eventInputManager->createEvent(ed);                                    //Insert the event into the Event Input Manager
210
211       if ((intptr_t)ed == EventInputManager::EIM_MAYCOME)
212       {
213         m_statistics->fragmentsMissed++;
214         fragment->setStatus(EventFragment::STATUS_MAYCOME);
215         DEBUG_TEXT(DFDB_ROSFM, 8, "PCMemoryDataChannel::getFragment: Fragment for L1ID " << ticket << " has not yet arrived");
216       }
217
218       if ((intptr_t)ed == EventInputManager::EIM_NEVERTOCOME)
219       {
220         m_statistics->fragmentsLost++;
221         fragment->setStatus(EventFragment::STATUS_LOST);
222         DEBUG_TEXT(DFDB_ROSFM, 8, "PCMemoryDataChannel::getFragment: Fragment for L1ID " << ticket << " does not exist");
223         CREATE_ROS_EXCEPTION(ex1, CoreException, PCMEMCHAN_LOST, "\n L1ID = " << ticket << ", ROL physical addr = " << physicalAddr    ess());
224         ers::warning(ex1);
225       }
226     }
227       catch (EventFragmentException& e)
228       {
229         DEBUG_TEXT(DFDB_ROSFM, 8, "PCMemoryDataChannel::getFragment:EventFragmentException");
230         DEBUG_TEXT(DFDB_ROSFM, 5, e);
231         m_mutex->unlock();
232         throw e;
233       }
234       m_mutex->unlock();
235       return(fragment);
236     }
237   }
238
239   if (m_fragType == 1)
240   {
241     DEBUG_TEXT(DFDB_ROSFM, 10, "PCMemoryDataChannel::getFragment: processing full fragment");
242     if ((intptr_t)ed == EventInputManager::EIM_MAYCOME || (intptr_t)ed == EventInputManager::EIM_NEVERTOCOME)
243     {
244       DEBUG_TEXT(DFDB_ROSFM, 5, "PCMemoryDataChannel::getFragment: Fragment for L1ID " << ticket << " is not available");
245       CREATE_ROS_EXCEPTION(ex1, CoreException, NODATA, "L1ID = " << ticket << ", ROL physical addr = " << physicalAddress());
246       throw(ex1);
247     }
248   }
249
250   m_statistics->fragmentsServed++;
251   DEBUG_TEXT(DFDB_ROSFM, 20, "PCMemoryDataChannel::getFragment: getById returns " << HEX(ed));
252   mem_page = ed->myPage;
253
254   DEBUG_TEXT(DFDB_ROSFM, 20, "PCMemoryDataChannel::getFragment: Dumping fields of this event descriptor:");
255   DEBUG_TEXT(DFDB_ROSFM, 20, "PCMemoryDataChannel::getFragment: Address of memory page = " << std::hex << mem_page << std::dec);
256   DEBUG_TEXT(DFDB_ROSFM, 20, "PCMemoryDataChannel::getFragment: Fragment size (bytes)  = " << ed->RODFragmentSize);
257   DEBUG_TEXT(DFDB_ROSFM, 20, "PCMemoryDataChannel::getFragment: Fragment status        = " << ed->RODFragmentStatus);
258
259   if (m_fragType == 0)
260   {
261     //<+gumh: add time
262     //u_long base = (u_long)(mem_page->address()) ;
263     //u_int *ptr = (u_int *)(base + sizeof(ROBFragment::ROBHeader) + sizeof(RODFragment::RODHeader) + 4 + sizeof(timeval)); // 4 ->     status element
264     //struct timeval tv ;
265     //gettimeofday(&tv, NULL) ;
266     //memcpy(ptr, &tv, sizeof(timeval)) ;
267
268     //u_int *ptr = (u_int *)(base + sizeof(ROBFragment::ROBHeader) + sizeof(RODFragment::RODHeader) + 4 + sizeof(timeval)); // 4 ->     status element
269     //+>
270
271     //Create a ROB Fragment in the Buffer and initialize it
272     fragment = new ROBFragment(mem_page, ed->RODFragmentSize, 0, m_sourceIdentifier);
273   }
274
275   if (m_fragType == 1)
276   {
277     //Create a Full Fragment in the Buffer
278     fragment = new FullFragment(mem_page);
279     DEBUG_TEXT(DFDB_ROSFM, 20, "PCMemoryDataChannel::getFragment: Full fragment is at " << HEX(fragment));
280   }
281
282   m_mutex->unlock();
283
284   DEBUG_TEXT(DFDB_ROSFM, 10, "PCMemoryDataChannel::getFragment: PCMemoryDataChannel:: got fragment with L1ID " << ticket);
285   DEBUG_TEXT(DFDB_ROSFM, 15, "PCMemoryDataChannel::getFragment: done");
286
287   return(fragment);
288 }
时间: 2024-10-10 14:35:19

ROSCore/src/PCMemoryDataChannel.cpp BUG的相关文章

【error】OpenCV Error: Parsing error (Missing or invalid SVM type) in read_params, file modules/ml/src/svm.cpp

前言 移植代码到板子上出现小问题,其实非常简单,但是不一定能立即想到,故还是记录一下.好记性不如烂笔头~ 错误 Vxworks上的error 0x21c411c0 (iRtp_imx6): RTP 0x2117b0e0 has been deleted due to signal 6. OpenCV Error: Parsing error (Missing or invalid SVM type) in read_params, file modules/ml/src/svm.cpp, lin

解决 NDK编程时cv::OutOfMemoryError(std::size_t), file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/alloc.cpp, line 52问题

详见:https://github.com/opencv/opencv/issues/4961 http://code.opencv.org/issues/4262 在Mat类型在OpenCV-java的使用方式和在C++中的使用方式不同,在C++中Mat是系统自动管理内存垃圾回收,而在Java中需要通过Mat.release;方法手动释放内存否则会出现标题错误

解决“cv2.error: OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:356:...”

主要是图片路径中“文件夹分隔符”使用的错误 将“\”改成“/”就好了 修改后的测试代码如下:x.py #导入cv模块 import cv2 as cv #读取图像,支持 bmp.jpg.png.tiff 等常用格式 img = cv.imread("./xx.png") #创建窗口并显示图像 cv.namedWindow("Image") cv.imshow("Image",img) cv.waitKey(0) #释放窗口 cv.destroyA

Makefile一个cpp文件依赖于多个header文件的陷阱

我一直以为,如果一个A.cpp文件中有多少条 #include "xxx.h"指令,在写Makefile的时候A.obj的依赖项除了A.cpp之外,就是A.cpp之内所有的 xxx.h 比如,如果A.cpp中有 #include "A.h" #include "B.h" #include "C.h",那么在Makefile中就有:A.obj: A.cpp A.h B.h C.h 但是 下面的例子是说明了,上面的想法是错误的 先

AndFix Bug热修复框架原理及源码解析

?? AndFix原理 AndFix的原理就是方法的替换,把有bug的方法替换成补丁文件中的方法.  注:在Native层使用指针替换的方式替换bug方法,已达到修复bug的目的. 使用AndFix修复热修复的整体流程: 方法替换过程: 源码解析 解析源码从使用的方法一一解析. 在自定义Application中初始化PatchManger: PatchManager mPatchManager = new PatchManager(); 1 1 直接实例化了一个PatchManger实例对象,接

caffe日常学习之:编译examples中的cpp文件描述文件——makefile

TARGET :=caffe_test CAFFE_DIR :=/home/kellygod/caffe CAFFE_INCLUDE :=$(CAFFE_DIR)/include CAFFE_BUILD :=$(CAFFE_DIR)/build CAFFE_BUILD_LIB := $(CAFFE_BUILD)/lib CAFFE_BUILD_SRC := $(CAFFE_BUILD)/src CUDA_PATH :=/usr/local/cuda-8.0 CUDA_INCLUDE:=$(CUD

cuda编程:不要在一个cpp文件中声明__device__和__global__函数

比如一下代码是正常的: kernel.h extern __global__ void kernel(); kernel.cu #include <stdio.h> #include "kernel.h" __global__ void kernel() { printf("hello world!"); } test.cu #include "kernel.h" int main(void) { kernel<<<

【bug】vue-cli 3.0报错的解决办法

先上bug图片 bug说明:初装vue_cli3.0写了个组件,运行错误,显示如图, 代码提示:[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build 思路:这里引用的是

一个在linux环境执行io操作的bug

今天项目有了一个奇葩的要求...是什么呢 后台上传了视频后,解析其中的时长,和预览图,并拼接在一起,然而,之东西并不是太麻烦,很快写好了,在本地测试后也没有问题,嗯,发布到测试环境后,一个jar包报错,看到这想想今天要加班了\/..\/ 出现的错误是javacv解析视频后,一个jni错误/home/travis/build/javacpp-presets/opencv/cppbuild/linux-x86_64/opencv-3.4.2/modules/videostab/src/frame_s