-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tools] Added -d (--detailed) paremeter to unfold 'Misc' contents in memap.py table #2845
Changes from 1 commit
f8af872
c1f2691
e0e25c1
99ac966
2b36d2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,11 @@ | |
import argparse | ||
from prettytable import PrettyTable | ||
|
||
from tools.utils import argparse_filestring_type, \ | ||
from utils import argparse_filestring_type, \ | ||
argparse_lowercase_hyphen_type, argparse_uppercase_type | ||
|
||
DEBUG = False | ||
DETAILED = False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Global variables should not change, so that if we ever need to run many of these concurrently in the same process, we can. Could we make this an object variable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean by this? just define it as lowercase? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean: Don't use a global variable for something that changes at runtime. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. args cannot be accessed from inside the path_object_to_module_name so, unless I add another parameter to path_object_to_module_name signature and propagate it all the way up to the main, I don't see how to implement this without a global variable. Is this what you would like me to implement? Is there an easier solution? It is like the 5th time or so that I code something in python so I'd appreciate the input :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could: remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the input :) Done |
||
RE_ARMCC = re.compile( | ||
r'^\s+0x(\w{8})\s+0x(\w{8})\s+(\w+)\s+(\w+)\s+(\d+)\s+[*]?.+\s+(.+)$') | ||
RE_IAR = re.compile( | ||
|
@@ -114,9 +115,17 @@ def path_object_to_module_name(txt): | |
module_name = data[0] + '/' + data[1] | ||
|
||
return [module_name, object_name] | ||
else: | ||
|
||
elif DETAILED: | ||
rex_obj_name = r'^.+\/(.+\.o\)*)$' | ||
test_rex_obj_name = re.match(rex_obj_name, txt) | ||
if test_rex_obj_name: | ||
object_name = test_rex_obj_name.group(1) | ||
return ['Misc/' + object_name, ""] | ||
|
||
return ['Misc', ""] | ||
else: | ||
return ['Misc', ""] | ||
|
||
|
||
def parse_section_gcc(self, line): | ||
""" Parse data from a section of gcc map file | ||
|
@@ -620,14 +629,19 @@ def main(): | |
", ".join(MemapParser.export_formats)) | ||
|
||
parser.add_argument('-v', '--version', action='version', version=version) | ||
|
||
parser.add_argument('-d', '--detailed', action='store_true', help='Displays the elements in "Misc" in a detailed fashion', required=False) | ||
|
||
# Parse/run command | ||
if len(sys.argv) <= 1: | ||
parser.print_help() | ||
sys.exit(1) | ||
|
||
|
||
args = parser.parse_args() | ||
args, remainder = parser.parse_known_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one slipped trough (I was porting my changes from an older version of memap.py I'll change it right away :) |
||
|
||
global DETAILED | ||
DETAILED = args.detailed | ||
|
||
# Create memap object | ||
memap = MemapParser() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot correctly drop the
tools.
from the front of this import. Please undo this change, as it has nothing to do with the feature being implemented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I didn't drop the tool from the front of the import I get the following error runing memap.py as standalone from the tools folder (python memap.py ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll leave it as it is then.