Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 866508 Details for
Bug 1068620
allow tracing 32bit apps on a 64bit system
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch
apitrace-4.0_support-32bit-preload.patch (text/plain), 3.47 KB, created by
Sandro Mani
on 2014-02-22 23:19:19 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sandro Mani
Created:
2014-02-22 23:19:19 UTC
Size:
3.47 KB
patch
obsolete
>diff -rupN apitrace-4.0/cli/cli_resources.cpp apitrace-4.0-new/cli/cli_resources.cpp >--- apitrace-4.0/cli/cli_resources.cpp 2013-05-02 09:05:06.000000000 +0200 >+++ apitrace-4.0-new/cli/cli_resources.cpp 2014-02-23 00:16:37.555258733 +0100 >@@ -32,6 +32,45 @@ > > #include "cli_resources.hpp" > >+#include <fstream> >+ >+// Stolen from elfio >+#define EI_NIDENT 16 >+#define EI_MAG0 0 >+#define EI_MAG1 1 >+#define EI_MAG2 2 >+#define EI_MAG3 3 >+#define EI_CLASS 4 >+#define ELFMAG0 0x7F >+#define ELFMAG1 'E' >+#define ELFMAG2 'L' >+#define ELFMAG3 'F' >+#define ELFCLASSNONE 0 >+#define ELFCLASS32 1 >+#define ELFCLASS64 2 >+ >+int get_elf_class(const char* filename) { >+ std::ifstream stream; >+ stream.open( filename, std::ios::in | std::ios::binary ); >+ if ( !stream ) { >+ return ELFCLASSNONE; >+ } >+ unsigned char e_ident[EI_NIDENT]; >+ >+ // Read ELF file signature >+ stream.seekg( 0 ); >+ stream.read( reinterpret_cast<char*>( &e_ident ), sizeof( e_ident ) ); >+ >+ // Is it ELF file? >+ if ( stream.gcount() != sizeof( e_ident ) || >+ e_ident[EI_MAG0] != ELFMAG0 || >+ e_ident[EI_MAG1] != ELFMAG1 || >+ e_ident[EI_MAG2] != ELFMAG2 || >+ e_ident[EI_MAG3] != ELFMAG3 ) { >+ return ELFCLASSNONE; >+ } >+ return e_ident[EI_CLASS]; >+} > > os::String > findProgram(const char*programFilename) >@@ -60,7 +99,7 @@ findProgram(const char*programFilename) > } > > os::String >-findWrapper(const char *wrapperFilename) >+findWrapper(const char *wrapperFilename, const char *argv0) > { > os::String wrapperPath; > >@@ -83,8 +122,21 @@ findWrapper(const char *wrapperFilename) > #elif defined(__APPLE__) > wrapperPath.join("../lib/wrappers"); > #else >+ // If we are on a 64-bit architecture, support tracing 32-bit executables by preloading the appropriate shared library >+#ifdef __LP64__ >+ int elfclass = get_elf_class(argv0); >+ if(elfclass == ELFCLASS32) { >+ wrapperPath.join("../lib/apitrace/wrappers"); >+ } else if(elfclass == ELFCLASS64) { >+ wrapperPath.join("../lib64/apitrace/wrappers"); >+ } else if(elfclass == ELFCLASSNONE) { >+ std::cerr << "error: failed to determine elf class for " << argv0 << ", assuming ELFCLASS64" << std::endl; >+ wrapperPath.join("../lib64/apitrace/wrappers"); >+ } >+#else > wrapperPath.join("../lib/apitrace/wrappers"); > #endif >+#endif > wrapperPath.join(wrapperFilename); > if (wrapperPath.exists()) { > return wrapperPath; >diff -rupN apitrace-4.0/cli/cli_resources.hpp apitrace-4.0-new/cli/cli_resources.hpp >--- apitrace-4.0/cli/cli_resources.hpp 2013-05-02 09:05:06.000000000 +0200 >+++ apitrace-4.0-new/cli/cli_resources.hpp 2014-02-22 23:47:43.917645323 +0100 >@@ -40,7 +40,7 @@ os::String > findScript(const char *name); > > os::String >-findWrapper(const char *wrapperFilename); >+findWrapper(const char *wrapperFilename, const char *argv0); > > > #endif /* _CLI_RESOURCES_HPP_ */ >diff -rupN apitrace-4.0/cli/cli_trace.cpp apitrace-4.0-new/cli/cli_trace.cpp >--- apitrace-4.0/cli/cli_trace.cpp 2013-05-02 09:05:06.000000000 +0200 >+++ apitrace-4.0-new/cli/cli_trace.cpp 2014-02-22 23:56:49.171897166 +0100 >@@ -126,7 +126,7 @@ traceProgram(trace::API api, > return 1; > } > >- os::String wrapperPath = findWrapper(wrapperFilename); >+ os::String wrapperPath = findWrapper(wrapperFilename, argv[0]); > if (!wrapperPath.length()) { > std::cerr << "error: failed to find " << wrapperFilename << "\n"; > goto exit;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1068620
: 866508