What does indentation mean in gdb dump? - gdb

0x80002bc <__execve>: pushl %ebp
0x80002bd <__execve+1>: movl %esp,%ebp
0x80002bf <__execve+3>: pushl %ebx
0x80002c0 <__execve+4>: movl $0xb,%eax
0x80002c5 <__execve+9>: movl 0x8(%ebp),%ebx
0x80002c8 <__execve+12>: movl 0xc(%ebp),%ecx
0x80002cb <__execve+15>: movl 0x10(%ebp),%edx
The last 2 lines are indented,what does it mean?

I think it is a "bug". There's a single tab behind the colon. When the offset reaches two digits (+12) this tab moves 8 spaces further.

Possibly it's a simple case of a TAB char.
Note that the first two lines are aligned and only when the colon breaks the TAB barrier the other lines are indented.

I guess it has no meaning at all. The indentation seems to be caused by tab-padding (every 8th character).

Related

Get digits after character in Google Sheets

I need to extract first two digits after character "R".
DATA:
165/70 R13 79T
225/75 R16C 118R
205/60 R16 92H
Tried this =REGEXEXTRACT(C2,"^R(.)"), but this is not quite necessary result.
Thank you!
use:
=REGEXEXTRACT(C2; "R(\d{2})")

Removing contiguous duplicate lines in VIM exception condition without sorting

I would like to perform the remove contiguous duplicate lines step with exception condition and without sorting in VIM
Example below:
Before Regex
a
b
c
d
00
f
b
00
c
e
00
After Run Regex
a
b
c
d
00
f
00
e
00
I want to delete duplicate lines without delete "00" pattern.
Vim is very powerful editor, however for this problem, I would turn to external utility for an easy solution.
If you have awk available(which is default installed on most linux distributions), you can do this in your vim:
:%!awk '/^00$/||\!a[$0]++'
With the following, it should work:
function! s:HandleLine()
let line = getline('.')
if has_key(s:seen, line)
delete
else
let s:seen[line] = 1
endif
endfunction
command! -range=% -nargs=1 UnsortUniq let s:seen={}<bar><line1>,<line2>v/<args>/call s:HandleLine()
Then execute :%UnsorUniq ^00$
My PatternsOnText plugin provides (among others) this command:
:%DeleteDuplicateLinesIgnoring /00/

How to avoid the 2nd alignment is affected by the 1st alignment?

My text example:
this is my text,this is,this is my text
this, this is my,this is my,this is text
I use Tabular plug-in to align text.
When I want to align at the 1st and 2nd occurrence of a single space '\s' I use these lines:
Tabularize /^\(.\{-}\zs\s\)\{1}/l0
Tabularize /^\(.\{-}\zs\s\)\{2}/l0
But I noted that the 1st alignment add spaces in order to align,
but the 2nd alignment is influenced by these extra spaces added and does not the right job.
How can I avoid this?
(I hope I made myself clear)
Edit:
This is what I expected:
this is my text,this is,this is my aatext
this, this is my,this is my,this is rtext
This is the outcome:
this is my text,this is,this is my aatext
this, this is my,this is my,this is rtext
Edit2:
This is my example with >= 2 spaces:
this is my text, this is,this is my aatext
this, this is my, this is my, this is rtext
Adapting the code proposed by Nikita Kouevda in his answer below:
Tabularize /\(^\(\(\S*\s\{2,}\)\{0}\|\(\S*\s\{2,}\)\{2}\)\)\#<=\S*\zs\s/l0
I expected:
this is my text, this is,this is my aatext
this, this is my, this is my, this is rtext
Outcome:
this is my text, this is,this is my aatext
this, this is my, this is my, this is rtext
I'm not familiar with Tabular and there might be an option to do this, but I would simply change the second \s to \s\+ in order to match any amount of whitespace:
Tabularize /^\(.\{-}\zs\s\+\)\{2}/l0
Edit: Here's a more proper solution, combining the steps into one:
Tabularize /\(^\(\S*\s\)\{,1}\)\#<=\S*\zs\s/l0
The first part is a lookbehind that matches up to the 0th or 1st space, any non-whitespace characters are then skipped, and the next space is matched (the 1st and 2nd, respectively). This can be generalized to any range; e.g. to align by the 2nd through 5th spaces, use \{1,4}.
Edit: If you need to align by a set of spaces that do not constitute a range in that sense, I would utilize logical ORs in the lookbehind. Unfortunately, this becomes much more clumsy and repetitive. For example, to align by the 1st and 3rd spaces:
Tabularize /\(^\(\(\S*\s\)\{0}\|\(\S*\s\)\{2}\)\)\#<=\S*\zs\s/l0
In order to align each column differently, specify multiple [lcr]# formats. Note that every separating and separated column is counted; e.g. an alignment by 2 spaces results in 5 columns that will be formatted. In order to align by the 1st and 3rd spaces, and to right justify the middle column of text:
Tabularize /\(^\(\(\S*\s\)\{0}\|\(\S*\s\)\{2}\)\)\#<=\S*\zs\s/l0l0r0l0l0
Since the formats cycle if you specify fewer than the number of columns, l0l0r0 would also suffice here, but it's probably a good idea to be explicit.

Backreferences to constituents of a group consisting of a fixed number of repetitions

I want to find a group that is repeated x times after each other, eg, five times a letter-digit combo separated by a space. I can use a simple repetition syntax, eg (?:\w\d ){5}.
I then want to replace the space in this 5x letter-digit with something else. For this, I try to backreference each of the letter-digit combos (without the space) by placing parentheses around it: (?:(\w\d) ){5}. Unfortunately, all five are store in $1, ie, $1 gets overwritten every time it matches.
So, is there a way to avoid this overwriting? Or is there a way to replace something only in a substring?
EDIT:
Example input string: A1 A3 A4 B6 ::: A1 A3 A4 C5 B6
Desired output string: A1 A3 A4 B6 ::: A1-A3-A4-C5-B6
That means, replace the space only if there are five of them. Implemented in Perl.
It's ugly and inflexible, but for your sample input, if it really is always five, and if your sample input never varies, this should work:
s/(\w\d) +(\w\d) +(\w\d) +(\w\d) +(\w\d) */$1-$2-$3-$4-$5/
If you just want to solve the problem, something like this works
$string = 'A1 A3 A4 B6 ::: A1 A3 A4 C5 B6';
$string =~ s/(\w\d(?: \w\d){4})/$_=$1; tr{ }{-}; $_/eg;
print "'$string'\n";
Otherwise, group repetition in Perl does overwrite the capture buffer every loop.
I don't know if another programatic way is possible.
edit
If you want to cover multiple spaces between character, add a + quantifier and the tr///s - squash duplicate replacements in tr///.
s/(\w\d(?: +\w\d){4})/$_=$1; tr{ }{-}s; $_/eg;
If you have fancier replacements you can always double up the regex with a callback style
equivalent
$string =~ s/(\w\d(?: +\w\d){4})/fixspaces($1)/eg;
sub fixspaces {
my $buf = shift;
$buf =~ s/ +/-/g;
$buf;
}
This works:
#!usr/bin/perl
sub substitute{
$substr=shift;
$substr=~s/\s/-/gi;
return $substr;
}
$test="hello a1 b2 c3 d4 e5 testing";
$test=~s/((?:\w\d\s){4})(\w\d)\s/&substitute($1).$2." "/egi;
print $test;

Finding a regular expression

I have a simple question about finding a regular expression for a given language.
I am given the language L where:
L = {w ∈ {0, 1}* : w has exactly one pair of consecutive zeros}
My first attempt at this was to try L( (0 + 1)* 00 (0 + 1)*), but I noticed the problem with that would be with where I have (0 + 1)* because if 0 is chosen, it can be zero more more of them, thus leading to more than one pair of consecutive zeros.
I also know, that the possible cases I have are, two zeros in the front, in the middle, and at the end. I just am not quite sure how to create a regular expression for that.
Any help is much appreciated.
Try this:
1* (011*)* 00 (11*0)* 1*
An explanation:
1*: any amount of leading 1’s
(011*)*: if there is a 0 before the 00, it must not be followed by another 0, thus only one or more 1’s are allowed; this pattern may be repeated any number of times
00: the two 0’s
(11*0)*: if there is a 0 after the 00, it must not preceded by another 0, thus only one or more 1’s; this pattern may be repeated any number of times
1*: any amount of trailing 1’s
The best possible answer for this problem is (1 + 01)* 00 (1 + 10)*
i believe it would be like this
((1*)(01)*))* 00 ((11*)0)*1*
The sequence:
Anything but 00, ending with 1
00
Anything but 00, starting with 1
My answer would be : (1 + 01) 00 (1 + 10)**
Explanation:
The consecutive zeros shouldn't be preceded or followed by another zero.
Hence 00 should be preceded by a 1 which can be either a 1 or 01.
It can be followed by a 1 or 10.