Skip to content
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

Improve objdump-nasm lexer #1981

Merged
merged 2 commits into from
Dec 28, 2021
Merged

Improve objdump-nasm lexer #1981

merged 2 commits into from
Dec 28, 2021

Conversation

pwilke
Copy link
Contributor

@pwilke pwilke commented Dec 7, 2021

This improves the objdump-nasm lexer in the following two ways :

  • output from objdump --no-show-raw-insn is now pretty-printed
  • comments starting with # are now also correctly interpreted

Take for example the following output from objdump :

$ cat foo.dump 

foo.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <foo>:
   0:	endbr64 
   4:	push   rbp
   5:	mov    rbp,rsp
   8:	sub    rsp,0x10
   c:	mov    DWORD PTR [rbp-0x4],edi
   f:	lea    rdi,[rip+0x0]        # 16 <foo+0x16>
  16:	call   1b <foo+0x1b>
  1b:	mov    eax,0x0
  20:	leave  
  21:	ret    

Running

pygmentize -l objdump-nasm -f html -O full -o /tmp/test.html /tmp/foo.dump 

with the original version of pygments results in the following unsatisfactory listing :
scr1

With these changes applied, the result is instead :

scr2

@Anteru Anteru merged commit 37c71f9 into pygments:master Dec 28, 2021
@Anteru
Copy link
Collaborator

Anteru commented Dec 28, 2021

Merged, thanks!

@Anteru Anteru added this to the 2.11.0 milestone Dec 28, 2021
Anteru added a commit that referenced this pull request Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants