Bug #2057

rsb-process-monitor crashes, probably when target binary has been built for a different architecture

Added by J. Moringen over 9 years ago. Updated over 9 years ago.

Status:ResolvedStart date:10/13/2014
Priority:LowDue date:
Assignee:J. Wienke% Done:

100%

Category:-
Target version:Robotics Service Bus - rsb-0.11

Description

What did I do?

gdb --args /vol/toolkit/nightly/x86_64/last/bin/rsb-process-monitor0.11 --pid 14854 -o /foo

In this case process 14854 is a Common Lisp logger for i686, i.e. a 32-bit ELF binary.

What happened?

Program received signal SIGSEGV, Segmentation fault.
rsbperfmon::getBuildId (execPath=...) at /home/jenkins/workspace/rsb-performance-monitor-master-toolkit-nightly/label/ubuntu_precise_64bit_techfak/src/common.cpp:174
174    /home/jenkins/workspace/rsb-performance-monitor-master-toolkit-nightly/label/ubuntu_precise_64bit_techfak/src/common.cpp: No such file or directory.
(gdb) bt
#0  rsbperfmon::getBuildId (execPath=...) at /home/jenkins/workspace/rsb-performance-monitor-master-toolkit-nightly/label/ubuntu_precise_64bit_techfak/src/common.cpp:174
#1  0x0000000000453d38 in rsbperfmon::MetaDataProvider::MetaDataProvider (this=0x6a8710, pid=@0x6bafe8: 14854) at /home/jenkins/workspace/rsb-performance-monitor-master-toolkit-nightly/label/ubuntu_precise_64bit_techfak/src/MetaDataProvider.cpp:50
#2  0x00000000004544d1 in rsbperfmon::MetaDataProviderFactory::create (this=<optimized out>, pid=@0x6bafe8: 14854) at /home/jenkins/workspace/rsb-performance-monitor-master-toolkit-nightly/label/ubuntu_precise_64bit_techfak/src/MetaDataProvider.cpp:70
#3  0x0000000000455b4a in rsbperfmon::MonitoringThread::addCueProvider (this=0x6baec0, factory=...) at /home/jenkins/workspace/rsb-performance-monitor-master-toolkit-nightly/label/ubuntu_precise_64bit_techfak/src/MonitoringThread.cpp:70
#4  0x000000000042e546 in main (argc=<optimized out>, argv=<optimized out>) at /home/jenkins/workspace/rsb-performance-monitor-master-toolkit-nightly/label/ubuntu_precise_64bit_techfak/src/process-monitor.cpp:244

What did I expect?

The monitor should either display a proper error message, successfully monitor the binary or monitor the binary with a reduced set of cues.

Associated revisions

Revision 2619db7d
Added by J. Wienke over 9 years ago

Read ELF build id for all bit architectures correctly

Fixes the extraction of build ids from the ELF format. So far, there was
an implicit assumption that the executable under observation has the
same bit architecture as the monitoring program itself. This assumption
has been removed.

This code could be much easier if libelf was used instead of manually
mangling around with the format. However, it seems that this dependency
is often not available. So I do not use it for now.

fixes #2057

History

#1 Updated by J. Moringen over 9 years ago

  • Description updated (diff)

#2 Updated by J. Wienke over 9 years ago

  • Status changed from New to In Progress

#3 Updated by J. Wienke over 9 years ago

Ok, currently there is the assumption that the ELF format of the executable to analyze matches the one of the architecture the monitor was compiled for. I need to find a way to read the ELF class first and then use the appropriate offsets in the ELF format depending on the class (32 / 64 bit).

This document gives some hints how to do this: http://sourceforge.net/projects/elftoolchain/files/Documentation/libelf-by-example/

#4 Updated by J. Wienke over 9 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Applied in changeset commit:rsb-performance-monitor|2619db7d9b604929f624872b9da4a85d8ad68bf8.

#5 Updated by J. Wienke over 9 years ago

  • Target version set to rsb-0.11

Also available in: Atom PDF