Trace32: Way to set number of rows displayed on a data.dump - trace32

For a data.dump, you can set the number of columns of the window displayed with the /columns option, but is there a way to set the number of rows displayed?
If I dump out only 4 addresses, the window is quite large.

If you want to limit the size of any window in TRACE32 use the command WinPOS.
E.g. if you want to have a Data.dump window at address D:0x100 with a hight of only two lines (one for the header and one for the content) use the following two commands:
WinPOS ,,,2.
Data.dump D:0x100
To skip also the header line use:
WinPOS ,,,1,,0
Data.dump D:0x100
You can also size the window like you like with the mouse, and then get the command to open the window exactly like that in you clipboard by using the command ClipSTOre WinTOP

If you want to have a limited dump of addresses use the command Data.dump with an address range as a parameter.
E.g. if you want to see four 32-bit values starting at the address D:0x100 use the command
Data.dump D:0x100--0x10F
or
Data.dump D:0x100++15.
The second from means: Start address and the following number of bytes. (The dot after the 15 in my example indicates that 15 is a decimal number. Without the dot it will probably interpenetrated as a hexadecimal value.)

Related

Parsing a list of strings and enumerate them based on line number

Can someone help me take a list of strings and enumerate string values based on line number?
Im trying to figure out how to parse all my known favorite network SSIDs and then assign each SSID a number based on the order from the output. Example:
If I run networksetup -listpreferredwirelessnetworks en0 (on macOS), I get the following output based on my recent Wi-Fi favorites list (Apple calls this the 'Preferred Network' list):
Preferred networks on en0:
Denny's
Hilton Hotel 2465
Hipster Cafe
My_Moms_Basement
Airport_bar
Marriot - Public-5G
OFFICE
I want to parse this output above, search/filter for my corporate SSID ("OFFICE" in this example) and then get its line number (in this case "OFFICE" is listed on line 8 - if you count the header "Preferred networks on en0:").
Ultimately I want to determine if SSID "OFFICE" is at the top of the list or not, and if it's NOT then I'll use the networksetup command to move it to the top - But I only want to take action if SSID "OFFICE" is not already at the top. Apple considers the top line “index 0” in this context (so line/array counting technically starts with 0,1,2,3 etc).
I have tried wc, sort, and various counting loops but I cant seem to get this to give me the output I want.
Thanks!
If you want to assign an index to every line of your file, you could use an array (declare -a in bash)
Assuming the lines you mentioned are in a file named "preferred_networks", you could write this to create the array (one entry of the array for every line) :
declare -a ssid
exec 5<./preferred_networks
((i=0))
while read line<&5; do
ssid[i]=$line
((++i))
done
Then you could read your array (containing $i elements) with the following loop:
for j in `seq 0 $i` ; do
echo ssid[$j]
done

Automatic list making?

There are bunch of pages of a same website.
the first one is
http://www.theeuropeanlibrary.org/tel4/search?classification-cerif=H000&iyear=[2000%20TO%202010]&offset=20
the next one is almost like the firt,but differs in the number at the last,and is 2 times 20 which is 40.so,the number for the 2000th address would be 2000 times 20.Now hw can i make a txt file containing the 2000 addresses which made out of the first one by
the rule i said above?
I don't have any programming experience,but
i have notepad ++ installed.
Copy the constant string in the first line of the new file in Notepad++
http://www.theeuropeanlibrary.org/tel4/search?classification-cerif=H000&iyear=[2000%20TO%202010]&offset=
duplicate this line (Ctrl+D) as many times you want
position the cursor at the end of the first line
Alt+Shift+Arrow down until the last line
enter the column mode Alt+C
in the popup window, enter the first number (i.e. 20) and the incremant (i.e. 20)
click OK
That's it.

How to make GDB format half-word memory as hex?

I'm working with an algorithm that uses uint16_t as the datatype. There are 4 half words in the array so I am trying to display the four half words in hex. I have not done anything other than x/4h:
(gdb) x/4h master_key
0x7fffffffd330: u"Āईᄐᤘ桷"
0x7fffffffd33c: u"桷敥\xbe0#"
0x7fffffffd346: u""
0x7fffffffd348: u"ꆋ翿"
According to the GDB | Memory:
f, the display format
The display format is one of the formats used by print (‘x’, ‘d’, ‘u’, ‘o’, ‘t’, ‘a’, ‘c’, ‘f’, ‘s’), and in addition ‘i’ (for machine
instructions). The default is ‘x’ (hexadecimal) initially. The default
changes each time you use either x or print.
I'm not sure why x is trying to print strings but I would like it to print the half words in hex.
GDB does not seem to be following the manual. I think I need to change the behavior of x and make it persistent. How do I tell GDB to print the half words in hex?
The following in in my .gdbinit but it looks like GDB is ignoring it (not a surprise).
(gdb) shell cat ~/.gdbinit
set output-radix 16
set history save on
set history size 256
set logging on
set logging overwrite on

Meaning of 3F7.1 in Fortran data format

I am trying to create an MDM file using HLM 7 Student version, but since I don't have access to SPSS I am trying to import my data using ASCII input. As part of this process I am required to input the data format Fortran style. Try as I might I have not been able to understand this step. Could someone familiar with Fortran (or even better HLM itself) explain to me how this works? Here is my current understanding
From the example EG3.DAT they give
(A4,1X,3F7.1)
I think
A4 signifies that the ID is 4 characters long.
1X means skip a space.
F.1 means that it should read 1 decimal places.
I am very confused about what 3F7 might mean.
EG3.DAT
2020 380.0 40.3 12.5
2040 502.0 83.1 18.6
2180 777.0 96.6 44.4
Below are examples from the help documents.
Rules for format statement
Format statement example
EG1 data format
EG2 data format
EG3 data format
One similar question is Explaining Fortran Write Format. Unfortunately it does not explicitly treat the F descriptor.
3F7.1 means 3 floating point numbers, each printed over 7 characters, each with one decimal number behind the decimal point. Leading characters are blanks.
For reading you don't need the .1 info at all, just read a floating point number from those 7 characters.
You guessed the meaning of A4 (string of four characters) and 1X (one blank) correctly.
In Fortran, so-called data edit descriptors (which format the input or output of data) may have repeat specifications.
In the format (A4,1X,3F7.1) the data edit descriptors are A4 and F7.1. Only F7.1 has a repeat specification (the number before the F). This simply means that the format is as though the descriptor appeared repeated: like F7.1, F7.1, F7.1. With a repeat specification of 1, or not given, there is just the single appearance.
The format of the question, then, is like
(A4,1X,F7.1,F7.1,F7.1)
This format is one that is covered by the rules provided in one of the images of the question. In particular, the aspect of repeat specification is given in rule 2 with the corresponding example of rule 3.
Further, in Fortran proper, a repeat count specifier may also be * as special case: that's like an exceptionally large repeat count. *(F7.1) would be like F7.1, F7.1, F7.1, .... I see no indication that this is supported by HLM but if this is needed a very large repeat count may be given instead.
In 1X the 1 isn't a repeat specification but an integral, and necessary, part of the position edit descriptor.
Procedure for making MDM file from excel for HLM:
-Make sure ALL the characters in ALL the columns line up
Select a column, then right click and select Format Cells
Then click on 'Custom' and go to the 'Type' box and enter the number
of 0s you need to line everything up
-Remove all the tabs from the document and replace them with spaces.
Open the document in word and use find and replace
-To save the document as .dat
First save it as .txt
Then open it in Notepad and save it as .dat
To enter the data format (FORTRAN-Style)
The program wants to read the data file space by space, so you have to specify it perfectly so that it reads the whole set properly.
If something is off, even by a single space, then your descriptive stats will be wonky compared to if you check them in another program.
Enclose the code with brackets ()
Divide the entries with commas ,
-Need ID column for all levels
ID column needs to be sorted so that it is in order from smallest to
largest
Use A# with # being the number of characters in the ID
Use an X1 to
move from the ID to the next column
-Need to say how many characters are needed in each column
Use F
After F is the number of characters needed for that column -Use F# (#= number)
There need to be enough character spaces to provide one 'gap' space
between each column
There need to be enough to character spaces to allow for the decimal
As part of the F you need to specify the number of decimal places
You do this by adding a decimal point after the F number and then a
number to represent the spaces you need -F#.#
You can use a number in front of the F so as to 'repeat' it. Not
necessary though. -#F#.#
All in all, it should look something like this:
(A4,X1,F4.0,F5.1)
Helpful links:
https://books.google.de/books?id=VdmVtz6Wtc0C&pg=PA78&lpg=PA78&dq=data+format+fortran+style+hlm&source=bl&ots=kURJ6USN5e&sig=fdtsmTGSKFxn04wkxvRc2Vw1l5Q&hl=en&sa=X&ved=0ahUKEwi_yPurjYrYAhWIJuwKHa0uCuAQ6AEIPzAC#v=onepage&q&f=false
http://www.ssicentral.com/hlm/help6/error/Problems_creating_MDM_files.pdf
http://www.ssicentral.com/hlm/help7/faq/FAQ_Format_specifications_for_ASCII_data.pdf

Search and replace in text file - add a constant to a numbered sequence

I've got a file, actually a .bat file but it could be any text file, with contents I want to update. I want to replace throughout the file the number after some text like this:
%varXX where XX is a number, one or two digits. The numbers go typically from 1 to 35.
Example: %var10 ---> add a known number to add to 10, like 2, result is %var12. I want to choose the number I start doing this at like 10 in this example and I want to choose the number to add to all of these occurrences, up to 35 occurrences. I will also need to, at times, subtract instead of add this number. I'm on a windows computer.
Update - found part solution using VIM:
:%s#%var\(\d\+\)#\='%var' . (submatch(1) + 3)#g
Here in this example, 3 is the amount I'm adding. However, this searches for any numbers following var and adds 3. How do I modify the above command to start at a number I choose?