Line 5... |
Line 5... |
* @brief Browse symbols command.
|
* @brief Browse symbols command.
|
*/
|
*/
|
|
|
#include "iservice.h"
|
#include "iservice.h"
|
#include "cmd_symb.h"
|
#include "cmd_symb.h"
|
#include "coreservices/ielfreader.h"
|
#include "coreservices/isrccode.h"
|
|
|
namespace debugger {
|
namespace debugger {
|
|
|
CmdSymb::CmdSymb(ITap *tap, ISocInfo *info)
|
CmdSymb::CmdSymb(ITap *tap, ISocInfo *info)
|
: ICommand ("symb", tap, info) {
|
: ICommand ("symb", tap, info) {
|
Line 40... |
Line 40... |
generateError(res, "Wrong argument list");
|
generateError(res, "Wrong argument list");
|
return;
|
return;
|
}
|
}
|
|
|
AttributeType lstServ;
|
AttributeType lstServ;
|
RISCV_get_services_with_iface(IFACE_ELFREADER, &lstServ);
|
RISCV_get_services_with_iface(IFACE_SOURCE_CODE, &lstServ);
|
if (lstServ.size() == 0) {
|
if (lstServ.size() == 0) {
|
generateError(res, "Elf-service not found");
|
generateError(res, "SourceCode service not found");
|
return;
|
return;
|
}
|
}
|
IService *iserv = static_cast<IService *>(lstServ[0u].to_iface());
|
IService *iserv = static_cast<IService *>(lstServ[0u].to_iface());
|
IElfReader *elf = static_cast<IElfReader *>(
|
ISourceCode *isrc = static_cast<ISourceCode *>(
|
iserv->getInterface(IFACE_ELFREADER));
|
iserv->getInterface(IFACE_SOURCE_CODE));
|
|
|
if (args->size() == 2 && (*args)[1].is_string()) {
|
if (args->size() == 2 && (*args)[1].is_string()) {
|
AttributeType allSymb;
|
AttributeType allSymb;
|
elf->getSymbols(&allSymb);
|
isrc->getSymbols(&allSymb);
|
applyFilter((*args)[1].to_string(), &allSymb, res);
|
applyFilter((*args)[1].to_string(), &allSymb, res);
|
} else {
|
} else {
|
elf->getSymbols(res);
|
isrc->getSymbols(res);
|
}
|
}
|
}
|
}
|
|
|
void CmdSymb::applyFilter(const char *filt, AttributeType *in,
|
void CmdSymb::applyFilter(const char *filt, AttributeType *in,
|
AttributeType *out) {
|
AttributeType *out) {
|