Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: native_client_sdk/src/libraries/xray/symtable.c

Issue 19409003: Update Xray for PNaCl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: the real changes Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/libraries/xray/report.c ('k') | native_client_sdk/src/libraries/xray/xray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/libraries/xray/symtable.c
diff --git a/native_client_sdk/src/libraries/xray/symtable.c b/native_client_sdk/src/libraries/xray/symtable.c
index 52f5c2b9ee33f2a5be0d52bd127c7609f6719a09..232bf1b737910ce56d4f16194e9a16c7fe6f55f1 100644
--- a/native_client_sdk/src/libraries/xray/symtable.c
+++ b/native_client_sdk/src/libraries/xray/symtable.c
@@ -16,6 +16,7 @@
#endif
#include "xray/xray_priv.h"
+#define PNACL_STRING_OFFSET (0x10000000)
nfullagar1 2013/07/18 23:49:42 one thought (for another CL...) is to have a known
#if defined(XRAY)
@@ -145,6 +146,19 @@ struct XRaySymbol* XRaySymbolTableLookup(struct XRaySymbolTable* symtab,
uint32_t addr) {
void *x = XRayHashTableLookup(symtab->hash_table, addr);
struct XRaySymbol* r = (struct XRaySymbol*)x;
+
+#if defined(__pnacl__)
+ if (r == NULL) {
+ /* Addresses are trimed to 24 bits for internal storage, so we need to
+ * add this offset back in order to get the real address.
+ */
+ addr |= PNACL_STRING_OFFSET;
+ const char* name = (const char*)addr;
+ struct XRaySymbol* symbol = XRaySymbolCreate(symtab->symbol_pool, name);
+ r = XRaySymbolTableAdd(symtab, symbol, addr);
+ }
+#endif
+
#if defined(__GLIBC__)
if (r == NULL) {
Dl_info info;
« no previous file with comments | « native_client_sdk/src/libraries/xray/report.c ('k') | native_client_sdk/src/libraries/xray/xray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698