Yu-hsin Wang has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/43105 )
Change subject: base: Add a rename helper to SymbolTable
......................................................................
base: Add a rename helper to SymbolTable
In some cases, we want to move and copy the symbol table to another
address. However, the name of symbol table should be unique. This rename
helper provides a way to modify the name of symbol. Developers can use
it to solve the conflict with this helper.
Change-Id: I4627e06da3a03da57009d613188be117c75750a0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43105
Reviewed-by: Daniel Carvalho <[email protected]>
Maintainer: Bobby R. Bruce <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/base/loader/symtab.hh
1 file changed, 15 insertions(+), 0 deletions(-)
Approvals:
Daniel Carvalho: Looks good to me, approved
Bobby R. Bruce: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/loader/symtab.hh b/src/base/loader/symtab.hh
index 5610544..c148289 100644
--- a/src/base/loader/symtab.hh
+++ b/src/base/loader/symtab.hh
@@ -153,6 +153,21 @@
return operate(op);
}
+ /// Modify symbol name with a given transform function.
+ /// @param func The transform function accepting the
reference of
+ /// symbol name.
+ /// @retval SymbolTablePtr A pointer to the modified SymbolTable copy.
+ SymbolTablePtr
+ rename(std::function<void(std::string&)> func) const
+ {
+ SymTabOp op = [func](SymbolTable &symtab, const Symbol &symbol) {
+ Symbol sym = symbol;
+ func(sym.name);
+ symtab.insert(sym);
+ };
+ return operate(op);
+ }
+
SymbolTablePtr
globals() const
{
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/43105
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I4627e06da3a03da57009d613188be117c75750a0
Gerrit-Change-Number: 43105
Gerrit-PatchSet: 3
Gerrit-Owner: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Earl Ou <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s