blob: 8a9073cca3740e051cc74f0fd923bfc791fbd394 [file] [log] [blame]
Zonr Chang862f3ba2012-04-12 12:19:15 +08001/*
2 * Copyright 2012, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Zonr Changc72c4dd2012-04-12 15:38:53 +080017#include "bcc/ExecutionEngine/SymbolResolverProxy.h"
Zonr Chang862f3ba2012-04-12 12:19:15 +080018
19using namespace bcc;
20
21void *SymbolResolverProxy::getAddress(const char *pName) {
22 // Search the address of the symbol by following the chain of resolvers.
Chris Wailes5e7d8762014-07-25 18:02:32 -070023 for (auto resolver : mChain) {
24 void *addr = resolver->getAddress(pName);
Zonr Chang862f3ba2012-04-12 12:19:15 +080025 if (addr != NULL) {
26 return addr;
27 }
28 }
Chris Wailes5e7d8762014-07-25 18:02:32 -070029
Zonr Chang862f3ba2012-04-12 12:19:15 +080030 // Symbol not found or there's no resolver containing in the chain.
31 return NULL;
32}
33
34void SymbolResolverProxy::chainResolver(SymbolResolverInterface &pResolver) {
35 mChain.push_back(&pResolver);
36}